public function authenticate(ExchangeIdSiteTokenRequest $exchangeIdSiteTokenRequest) { $attempt = new ExchangeIdSiteTokenAttempt(); $attempt->setGrantType($exchangeIdSiteTokenRequest->getGrantType())->setToken($exchangeIdSiteTokenRequest->getToken()); $grantResult = $this->application->dataStore->create($this->application->getHref() . self::OAUTH_TOKEN_PATH, $attempt, \Stormpath\Stormpath::GRANT_AUTHENTICATION_TOKEN); $builder = new OauthGrantAuthenticationResultBuilder($grantResult); return $builder->build(); }
public function authenticate(PasswordGrantRequest $passwordGrantRequest) { $passwordGrantAuthenticationAttempt = new PasswordGrantAuthenticationAttempt(); $passwordGrantAuthenticationAttempt->setLogin($passwordGrantRequest->getLogin())->setPassword($passwordGrantRequest->getPassword())->setGrantType($passwordGrantRequest->getGrantType()); if ($passwordGrantRequest->getAccountStore() != null) { $passwordGrantAuthenticationAttempt->setAccountStore($passwordGrantRequest->getAccountStore()); } $grantResult = $this->application->dataStore->create($this->application->getHref() . self::OAUTH_TOKEN_PATH, $passwordGrantAuthenticationAttempt, \Stormpath\Stormpath::GRANT_AUTHENTICATION_TOKEN); $builder = new OauthGrantAuthenticationResultBuilder($grantResult); return $builder->build(); }