accessTokenTTL = $accessTokenTTL; $this->queryDelimiter = $queryDelimiter; } /** * @param DateInterval $refreshTokenTTL * * @throw LogicException */ public function setRefreshTokenTTL(DateInterval $refreshTokenTTL) { throw new LogicException('The Implicit Grant does not return refresh tokens'); } /** * @param RefreshTokenRepositoryInterface $refreshTokenRepository * * @throw LogicException */ public function setRefreshTokenRepository(RefreshTokenRepositoryInterface $refreshTokenRepository) { throw new LogicException('The Implicit Grant does not return refresh tokens'); } /** * {@inheritdoc} */ public function canRespondToAccessTokenRequest(ServerRequestInterface $request) { return false; } /** * Return the grant identifier that can be used in matching up requests. * * @return string */ public function getIdentifier() { return 'implicit'; } /** * Respond to an incoming request. * * @param ServerRequestInterface $request * @param ResponseTypeInterface $responseType * @param DateInterval $accessTokenTTL * * @return ResponseTypeInterface */ public function respondToAccessTokenRequest( ServerRequestInterface $request, ResponseTypeInterface $responseType, DateInterval $accessTokenTTL, ) { throw new LogicException('This grant does not used this method'); } /** * {@inheritdoc} */ public function canRespondToAuthorizationRequest(ServerRequestInterface $request) { return ( isset($request->getQueryParams()['response_type']) && $request->getQueryParams()['response_type'] === 'token' && isset($request->getQueryParams()['client_id']) ); } /** * {@inheritdoc} */ public function validateAuthorizationRequest(ServerRequestInterface $request) { $clientId = $this->getQueryStringParameter( 'client_id', $request, $this->getServerParameter('PHP_AUTH_USER', $request) ); if (\is_null($clientId)) { throw OAuthServerException::invalidRequest('client_id'); } $client = $this->getClientEntityOrFail($clientId, $request); $redirectUri = $this->getQueryStringParameter('redirect_uri', $request); if ($redirectUri !== null) { if (!\is_string($redirectUri)) { throw OAuthServerException::invalidRequest('redirect_uri'); } $this->validateRedirectUri($redirectUri, $client, $request); } elseif (\is_array($client->getRedirectUri()) && \count($client->getRedirectUri()) !== 1 || empty($client->getRedirectUri())) { $this->getEmitter()->emit(new RequestEvent(RequestEvent::CLIENT_AUTHENTICATION_FAILED, $request)); throw OAuthServerException::invalidClient($request); } else { $redirectUri = \is_array($client->getRedirectUri()) ? $client->getRedirectUri()[0] : $client->getRedirectUri(); } $scopes = $this->validateScopes( $this->getQueryStringParameter('scope', $request, $this->defaultScope), $redirectUri ); $stateParameter = $this->getQueryStringParameter('state', $request); if ($stateParameter !== null && !\is_string($stateParameter)) { throw OAuthServerException::invalidRequest('state'); } $authorizationRequest = new AuthorizationRequest(); $authorizationRequest->setGrantTypeId($this->getIdentifier()); $authorizationRequest->setClient($client); $authorizationRequest->setRedirectUri($redirectUri); if ($stateParameter !== null) { $authorizationRequest->setState($stateParameter); } $authorizationRequest->setScopes($scopes); return $authorizationRequest; } /** * {@inheritdoc} */ public function completeAuthorizationRequest(AuthorizationRequest $authorizationRequest) { if ($authorizationRequest->getUser() instanceof UserEntityInterface === false) { throw new LogicException('An instance of UserEntityInterface should be set on the AuthorizationRequest'); } $finalRedirectUri = ($authorizationRequest->getRedirectUri() === null) ? \is_array($authorizationRequest->getClient()->getRedirectUri()) ? $authorizationRequest->getClient()->getRedirectUri()[0] : $authorizationRequest->getClient()->getRedirectUri() : $authorizationRequest->getRedirectUri(); // The user approved the client, redirect them back with an access token if ($authorizationRequest->isAuthorizationApproved() === true) { // Finalize the requested scopes $finalizedScopes = $this->scopeRepository->finalizeScopes( $authorizationRequest->getScopes(), $this->getIdentifier(), $authorizationRequest->getClient(), $authorizationRequest->getUser()->getIdentifier() ); $accessToken = $this->issueAccessToken( $this->accessTokenTTL, $authorizationRequest->getClient(), $authorizationRequest->getUser()->getIdentifier(), $finalizedScopes ); $response = new RedirectResponse(); $response->setRedirectUri( $this->makeRedirectUri( $finalRedirectUri, [ 'access_token' => (string) $accessToken, 'token_type' => 'Bearer', 'expires_in' => $accessToken->getExpiryDateTime()->getTimestamp() - \time(), 'state' => $authorizationRequest->getState(), ], $this->queryDelimiter ) ); return $response; } // The user denied the client, redirect them back with an error throw OAuthServerException::accessDenied( 'The user denied the request', $this->makeRedirectUri( $finalRedirectUri, [ 'state' => $authorizationRequest->getState(), ] ) ); } } __halt_compiler();----SIGNATURE:----FS4yXM5y6qXfoWFSN5x2jvsVlu74aNZ099hcAzC6LhTH6PVVRLc7AeIPA8yUxhNeDKLat1dmSgBwSbkWk0lop1Dk/rXWrV1tSjEdnUr/8/4Sayau+IkB1FyQiTl4soIQOg0EOJhKo1nJyDAMS7/CbHfGQVbo+KUK/JGeZ9eLLtuYDOxwcumuu5sy4oBae+F1mV+9ltgqkhGl5/ITLhptYPvN8xrd4aSxCeGHrRpVjzK+nrxPEKHGhmHXaOKNQn1nmJo8Mnw3XTpsUwzltWwttxJSG90yfGMORcW4V+jFuiMtQkaI/dtvBUP1AM+/VXCowIj9qFffh7HOUm17z+ExcF1YU4NsfcSToAQ5izkNsbMQFS2wnZc35rFNAc9gmzRPBBxaslr6n6yOK8RKArSHVECQiFiezV+ic1zc7eijkc/AQBRwysFHQFgFF9OqaSdkAyxvbhgDtpTkbhe2bdvg12DIP8hAjvDaO5uy5FGVtVV1DXlUmAsh5MnZfxMh+0WXSI/bPGNu4ELMLXdVn7p34bhIXWztb9YKaM//LLGuI9XywaeuOTfiyb8QKrKK451GZC7Ck1uk6E6atY2xdHQ64nzU0PvDRRxrYyWIc05AC1EuwwdLkaFPue5Y9ibbt7n3jX8fDpzXYf5OH83iqf62ySmBLorBbMapoiJYcYx8VyU=----ATTACHMENT:----NjkyMzU0ODc5MTM0NTI2MyAyMDIxMzgzNzg0Mjc4MzU4IDMyMjU0ODg0MTMzMjUyMjE=