/** * @param AccessTokenRequestAwareGrantInterface $grant * @param ClientType $clientType */ protected function checkIsGrantSupportClientType(AccessTokenRequestAwareGrantInterface $grant, ClientType $clientType) { $isSupported = array_reduce($grant->getSupportedClientTypesForAuthentication(), function ($isSupported = false, $supportedClientType) use($clientType) { $isSupported = $isSupported === true || $supportedClientType->getValue() === $clientType->getValue(); return $isSupported; }); if (!$isSupported) { throw new InvalidArgumentException(sprintf("Unsupported client type '%s' for grant '%s'.", $clientType->getValue(), $grant->getAccessTokenRequest()->getGrantType()->getValue()), 0, null, null); } }
/** * @return ClientType[] */ public function getSupportedClientTypesForAuthentication() { return array(ClientType::CONFIDENTIAL_TYPE()); }