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:
parent
6712150ad6
commit
4d339e1eb4
|
@ -432,7 +432,8 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
|
||||||
if (is_null($token)) {
|
if (is_null($token)) {
|
||||||
return $this->error404(array('error' => sprintf('access token %s does not exists!', $value)));
|
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(
|
return $this->error412(array(
|
||||||
'error' => sprintf('access token %s does not belongs to client id !', $value, $id)
|
'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)) {
|
if (is_null($token)) {
|
||||||
return $this->error404(array('error' => sprintf('refresh token %s does not exists!', $value)));
|
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(
|
return $this->error412(array(
|
||||||
'error' => sprintf('refresh token %s does not belongs to client id !', $value, $id)
|
'error' => sprintf('refresh token %s does not belongs to client id !', $value, $id)
|
||||||
));
|
));
|
||||||
|
|
|
@ -586,7 +586,6 @@ final class TokenService implements ITokenService
|
||||||
return $access_token;
|
return $access_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RefreshToken $refresh_token
|
* @param RefreshToken $refresh_token
|
||||||
* @param null $scope
|
* @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;
|
$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(
|
$this->cache_service->storeHash($access_token->value, array(
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'client_id' => $access_token->client_id,
|
'client_id' => $client->client_id,
|
||||||
'scope' => $access_token->scope,
|
'scope' => $access_token->scope,
|
||||||
'auth_code' => $access_token->associated_authorization_code,
|
'auth_code' => $access_token->associated_authorization_code,
|
||||||
'issued' => $access_token->created_at,
|
'issued' => $access_token->created_at,
|
||||||
'lifetime' => $access_token->lifetime,
|
'lifetime' => $access_token->lifetime,
|
||||||
'from_ip' => $access_token->from_ip,
|
'from_ip' => $access_token->from_ip,
|
||||||
'audience' => $access_token->audience,
|
'audience' => $access_token->audience,
|
||||||
'refresh_token' => $refresh_token_value
|
'refresh_token' => $refresh_token_value
|
||||||
)
|
)
|
||||||
, intval($access_token->lifetime));
|
, intval($access_token->lifetime));
|
||||||
|
|
Loading…
Reference in New Issue