Fix on revoke UI (Admin)

client id was saved wrong, so there were sometimes that user
cant revoke a token manually

Change-Id: I8dafa8ebff832482af04ea17b6f5a2bb8db4742c
This commit is contained in:
Sebastian Marcet 2016-03-23 19:37:57 -03:00
parent 6712150ad6
commit 4d339e1eb4
2 changed files with 13 additions and 11 deletions

View File

@ -432,7 +432,8 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
if (is_null($token)) {
return $this->error404(array('error' => sprintf('access token %s does not exists!', $value)));
}
if (intval($token->getClientId()) !== intval($client->id)) {
Log::debug(sprintf('access token client id %s - client id %s ',$token->getClientId() , $client->client_id));
if ($token->getClientId() !== $client->client_id) {
return $this->error412(array(
'error' => sprintf('access token %s does not belongs to client id !', $value, $id)
));
@ -445,7 +446,8 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
if (is_null($token)) {
return $this->error404(array('error' => sprintf('refresh token %s does not exists!', $value)));
}
if (intval($token->getClientId()) !== intval($client->id)) {
Log::debug(sprintf('refresh token client id %s - client id %s ',$token->getClientId() , $client->client_id));
if ($token->getClientId() !== $client->client_id) {
return $this->error412(array(
'error' => sprintf('refresh token %s does not belongs to client id !', $value, $id)
));

View File

@ -586,7 +586,6 @@ final class TokenService implements ITokenService
return $access_token;
}
/**
* @param RefreshToken $refresh_token
* @param null $scope
@ -760,16 +759,17 @@ final class TokenService implements ITokenService
}
$user_id = !is_null($access_token->user_id) ? $access_token->user_id : 0;
$client = $access_token->client()->first();
$this->cache_service->storeHash($access_token->value, array(
'user_id' => $user_id,
'client_id' => $access_token->client_id,
'scope' => $access_token->scope,
'auth_code' => $access_token->associated_authorization_code,
'issued' => $access_token->created_at,
'lifetime' => $access_token->lifetime,
'from_ip' => $access_token->from_ip,
'audience' => $access_token->audience,
'user_id' => $user_id,
'client_id' => $client->client_id,
'scope' => $access_token->scope,
'auth_code' => $access_token->associated_authorization_code,
'issued' => $access_token->created_at,
'lifetime' => $access_token->lifetime,
'from_ip' => $access_token->from_ip,
'audience' => $access_token->audience,
'refresh_token' => $refresh_token_value
)
, intval($access_token->lifetime));