public static function ensureRequestedGrantTypeIsSupported(GrantType $grantType, TokenRequestAttempt $tokenRequestAttempt) { if (strtolower($grantType->getIdentifier()) !== strtolower($tokenRequestAttempt->getGrantType())) { throw new UnsupportedGrantType(self::class, $grantType->getIdentifier(), $tokenRequestAttempt->getGrantType()); } }
private function checkIfClientSupportsRequestedGrantType(TokenRequestAttempt $tokenRequestAttempt) { $client = $this->clientStorage->findById($tokenRequestAttempt->getInputData()->getClientId()); return in_array($tokenRequestAttempt->getGrantType(), $client->getAllowedGrantTypes()); }