mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
Add a new "missing_token" exception message to Resource server
This commit is contained in:
parent
da92410ecb
commit
f03e4a9e37
@ -84,6 +84,7 @@ class Resource
|
|||||||
0 => 'invalid_request',
|
0 => 'invalid_request',
|
||||||
1 => 'invalid_token',
|
1 => 'invalid_token',
|
||||||
2 => 'insufficient_scope',
|
2 => 'insufficient_scope',
|
||||||
|
3 => 'missing_token',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,6 +95,7 @@ class Resource
|
|||||||
'invalid_request' => 'The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "%s" parameter.',
|
'invalid_request' => 'The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "%s" parameter.',
|
||||||
'invalid_token' => 'The access token provided is expired, revoked, malformed, or invalid for other reasons.',
|
'invalid_token' => 'The access token provided is expired, revoked, malformed, or invalid for other reasons.',
|
||||||
'insufficient_scope' => 'The request requires higher privileges than provided by the access token. Required scopes are: %s.',
|
'insufficient_scope' => 'The request requires higher privileges than provided by the access token. Required scopes are: %s.',
|
||||||
|
'missing_token' => 'The request is missing an access token in either the Authorization header or the %s request parameter.',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,6 +111,7 @@ class Resource
|
|||||||
'invalid_request' => 400,
|
'invalid_request' => 400,
|
||||||
'invalid_token' => 401,
|
'invalid_token' => 401,
|
||||||
'insufficient_scope' => 403,
|
'insufficient_scope' => 403,
|
||||||
|
'missing_token' => 400,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -387,7 +390,7 @@ class Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($accessToken)) {
|
if (empty($accessToken)) {
|
||||||
throw new Exception\MissingAccessTokenException(self::$exceptionMessages['invalid_request'], 0);
|
throw new Exception\MissingAccessTokenException(sprintf(self::$exceptionMessages['missing_token'], $this->tokenKey), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $accessToken;
|
return $accessToken;
|
||||||
|
Loading…
Reference in New Issue
Block a user