setUserRepository($userRepository); $this->setRefreshTokenRepository($refreshTokenRepository); $this->refreshTokenTTL = new DateInterval('P1M'); } /** * {@inheritdoc} */ public function respondToAccessTokenRequest( ServerRequestInterface $request, ResponseTypeInterface $responseType, DateInterval $accessTokenTTL, ) { // Validate request $client = $this->validateClient($request); $scopes = $this->validateScopes($this->getRequestParameter('scope', $request, $this->defaultScope)); $user = $this->validateUser($request, $client); // Finalize the requested scopes $finalizedScopes = $this->scopeRepository->finalizeScopes($scopes, $this->getIdentifier(), $client, $user->getIdentifier()); // Issue and persist new access token $accessToken = $this->issueAccessToken($accessTokenTTL, $client, $user->getIdentifier(), $finalizedScopes); $this->getEmitter()->emit(new RequestAccessTokenEvent(RequestEvent::ACCESS_TOKEN_ISSUED, $request, $accessToken)); $responseType->setAccessToken($accessToken); // Issue and persist new refresh token if given $refreshToken = $this->issueRefreshToken($accessToken); if ($refreshToken !== null) { $this->getEmitter()->emit(new RequestRefreshTokenEvent(RequestEvent::REFRESH_TOKEN_ISSUED, $request, $refreshToken)); $responseType->setRefreshToken($refreshToken); } return $responseType; } /** * @param ServerRequestInterface $request * @param ClientEntityInterface $client * * @throws OAuthServerException * * @return UserEntityInterface */ protected function validateUser(ServerRequestInterface $request, ClientEntityInterface $client) { $username = $this->getRequestParameter('username', $request); if (!\is_string($username)) { throw OAuthServerException::invalidRequest('username'); } $password = $this->getRequestParameter('password', $request); if (!\is_string($password)) { throw OAuthServerException::invalidRequest('password'); } $user = $this->userRepository->getUserEntityByUserCredentials( $username, $password, $this->getIdentifier(), $client ); if ($user instanceof UserEntityInterface === false) { $this->getEmitter()->emit(new RequestEvent(RequestEvent::USER_AUTHENTICATION_FAILED, $request)); throw OAuthServerException::invalidCredentials(); } return $user; } /** * {@inheritdoc} */ public function getIdentifier() { return 'password'; } } __halt_compiler();----SIGNATURE:----Nq14OWNAqn0qKXG27NPPI7aF2ba4USxQbY5oloKvaqYhbW+bJhgOfdkIsoyIkq0tWlh/MrUvcB/lddTucFjTF6Nxyk/PpcjAlDxWQtTNCKnooLM/ofvUhR46KNSvyRXMZI5DKZNVxQvIv7Mub+ZIj1eUGNad213KrkENKao5GRI9Jk2kj8Sb7qhrqE9ks6UR3BL+5FmYpLzmJ/gprSkD3vgw6UnANB3MZriP0eX/IR4Z2JctJWiqi1YcgjfnSVqNQzhakqSvJotape8L2y3wvCHYquD0uubqk7JXOdGK7DZnX4BNdVdznp5Qabehl7K7Xpp1qcAo3j26vQc1Y6DmszRV5R9qzN3aFGWKvGt/GbMgC8j/U9Jzr+mzABb3pQAqhnK5SDx3nQLckYH2igqwUDwxSIxyNKaFegZHFdUJQX6b2yUMIOr75/qER+hBj2I+C8mjabOjcU0/kQnCDlqR85ih6kYNlgWzWa+8pL5r0SkF/Pi1Rj5COX4T7p+szSqlLlaLVd7GoVqd0kKiD8lQJSAwHKwwh1kJUirTaAHqT7gglUD3DJebIx7mntMlY8NGY3z/1F4Vh5Rb6EKQaoUelejlTiSoGs+NDyBDmg9740CqPqtVEa/1XqB+6CJz+ySTm17v/YzuVlafPEPS/RHsyNcqIJUTSL6UGJCv0hbJA4Q=----ATTACHMENT:----NTE4Njk0NDAyMTEzNjMzOCA5MzAxNjYwODAwNjk4NDY2IDk4ODEwMTU2NzMxODAwMzk=