mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-02-24 11:48:03 +05:30
Code tidy
This commit is contained in:
parent
13a1ea6db8
commit
d565665ccb
@ -86,7 +86,7 @@ class ClientCredentialsGrant extends AbstractGrant
|
|||||||
$accessToken->setIdentifier(SecureKey::generate());
|
$accessToken->setIdentifier(SecureKey::generate());
|
||||||
$accessToken->setExpiryDateTime((new \DateTime())->add($accessTokenTTL));
|
$accessToken->setExpiryDateTime((new \DateTime())->add($accessTokenTTL));
|
||||||
$accessToken->setClient($client);
|
$accessToken->setClient($client);
|
||||||
$accessToken->setOwner('client', $client->getIdentifier());
|
$accessToken->setUserIdentifier($client->getIdentifier());
|
||||||
|
|
||||||
// Associate scopes with the session and access token
|
// Associate scopes with the session and access token
|
||||||
foreach ($scopes as $scope) {
|
foreach ($scopes as $scope) {
|
||||||
@ -103,26 +103,13 @@ class ClientCredentialsGrant extends AbstractGrant
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The grant type should return true if it is able to respond to this request.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* For example most grant types will check that the $_POST['grant_type'] property matches it's identifier property.
|
|
||||||
*
|
|
||||||
* Some grants, such as the authorization code grant can respond to multiple requests
|
|
||||||
* - i.e. a client requesting an authorization code and requesting an access token
|
|
||||||
*
|
|
||||||
* @param \Psr\Http\Message\ServerRequestInterface $request
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
public function canRespondToRequest(ServerRequestInterface $request)
|
public function canRespondToRequest(ServerRequestInterface $request)
|
||||||
{
|
{
|
||||||
if (
|
return (
|
||||||
isset($request->getParsedBody()['grant_type'])
|
array_key_exists('grant_type', $request->getParsedBody())
|
||||||
&& $request->getParsedBody()['grant_type'] === 'client_credentials'
|
&& $request->getParsedBody()['grant_type'] === 'client_credentials'
|
||||||
) {
|
);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user