protected function grantAccessTokenClientCredentials(IOAuth2Client $client, array $input, array $clientCredentials)
{
if (!$this->storage instanceof IOAuth2GrantClient) {
throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_UNSUPPORTED_GRANT_TYPE);
}
if (empty($clientCredentials[1])) {
throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_CLIENT, 'The client_secret is mandatory for the "client_credentials" grant type');
}
$stored = $this->storage->checkClientCredentialsGrant($client, $clientCredentials[1]);
if ($stored === false) {
throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_GRANT);
}
if (!is_array($stored)) {
$stored = array();
}
$stored += array('issue_refresh_token' => false);
return $stored;
}