/** * @param \OAuth2\Client\ClientInterface $client * @param \OAuth2\EndUser\EndUserInterface $end_user * * @return bool */ private function getIssueRefreshToken(ClientInterface $client, EndUserInterface $end_user) { if ($end_user instanceof IssueRefreshTokenExtensionInterface && false === $end_user->isRefreshTokenIssuanceAllowed($client, 'password')) { return false; } return $this->getConfiguration()->get('allow_refresh_token_with_resource_owner_grant_type', true); }
public function checkEndUserPasswordCredentials(EndUserInterface $end_user, $password) { if (!$end_user instanceof EndUser) { return false; } return $end_user->getPassword() === $password; }
protected function addAuthCode($code, $expiresAt, ClientInterface $client, EndUserInterface $end_user, array $query_params, $redirectUri, array $scope = [], $issueRefreshToken = false) { $class = $this->getClass(); /* * @var \SpomkyLabs\OAuth2ServerBundle\Plugin\AuthCodeGrantTypePlugin\Model\AuthCodeInterface */ $authcode = new $class(); $authcode->setRedirectUri($redirectUri)->setQueryParams($query_params)->setIssueRefreshToken($issueRefreshToken)->setToken($code)->setResourceOwnerPublicId($end_user->getPublicId())->setExpiresAt($expiresAt)->setClientPublicId($client->getPublicId())->setScope($scope); $this->getEntityManager()->persist($authcode); $this->getEntityManager()->flush(); return $authcode; }