Fix 400 error on auth code grant

readded code to get user by user id on
auth code if session cookie is missing

Change-Id: I7e40b5165acc9388229f322e9822ef1b0502f00c
This commit is contained in:
Sebastian Marcet 2018-08-08 15:56:55 -03:00
parent fccca4cb19
commit 0b72dc999d
2 changed files with 13 additions and 1 deletions

View File

@ -1436,7 +1436,13 @@ final class TokenService implements ITokenService
$user = $this->auth_service->getCurrentUser();
if(!$user)
if(is_null($user)){
$user_id = $this->principal_service->get()->getUserId();
Log::debug(sprintf("user id is %s", $user_id));
$user = $this->auth_service->getUserById($user_id);
}
if(is_null($user))
throw new AbsentCurrentUserException;
// build claim set

View File

@ -250,6 +250,12 @@ class AuthorizationCodeGrantType extends InteractiveGrantType
throw new UriNotAllowedException($current_redirect_uri);
}
$this->principal_service->register
(
$auth_code->getUserId(),
$auth_code->getAuthTime()
);
$response = OAuth2AccessTokenResponseFactory::build
(
$this->token_service,