public abstract class OAuthAuthorization extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ACCESS_FORBIDDEN
Error code passed as a
httpRequest parameter attribute with a name
reason , in case of faild authorization. |
static String |
INVALID_ACCESS_TOKEN
Error code passed as a
httpRequest parameter attribute with a name
reason in case of failed authorization when the passed access token
does not exist or when it has already expired. |
static String |
MISSING_ACCESS_TOKEN
Error code passed as a
httpRequest parameter attribute with a name
reason in case of failed authorization when the access token is not
passed as an HTTP "Authorization" request header. |
Constructor and Description |
---|
OAuthAuthorization() |
Modifier and Type | Method and Description |
---|---|
static OAuthAuthorization |
getOAuthAuthorizationService()
Returns OAuth Authorization object that is used to perform the protected
resource access check by retrieving from the Authorization Server the
scopes associated with the given Access Token.
|
abstract boolean |
isAuthorized(HttpServletRequest httpRequest)
This method is only for authentication purpose with the given Access Token.
|
abstract boolean |
isAuthorized(HttpServletRequest httpRequest,
Set<String> scopes)
Performs the protected resource access check by retrieving from the
Authorization Server the scopes associated with the given Access Token,
compares them with the passed scopes and checks the Token validity.
|
abstract boolean |
isAuthorized(HttpServletRequest httpRequest,
String scope)
Performs the protected resource access check by retrieving from the
Authorization Server the scopes associated with the given Access Token,
compares them with the passed scopes and checks the Token validity.
|
abstract boolean |
isAuthorized(Set<String> scopes)
Performs the protected resource access check by retrieving
the scopes from the currently logged in user and comparing
them with the passed scopes.
|
abstract boolean |
isAuthorized(String scope)
Performs the protected resource access check by retrieving
the scopes from the currently logged in user and comparing
them with the passed scope.
|
public static final String ACCESS_FORBIDDEN
httpRequest
parameter attribute with a name
reason
, in case of faild authorization.public static final String MISSING_ACCESS_TOKEN
httpRequest
parameter attribute with a name
reason
in case of failed authorization when the access token is not
passed as an HTTP "Authorization" request header.public static final String INVALID_ACCESS_TOKEN
httpRequest
parameter attribute with a name
reason
in case of failed authorization when the passed access token
does not exist or when it has already expired.public static OAuthAuthorization getOAuthAuthorizationService()
public abstract boolean isAuthorized(HttpServletRequest httpRequest) throws OAuthSystemException
"bearer"
.
For example the header could look like:
The given example is provided for illustration purposes only."Authorization: Bearer mF_9.B5f-4.1JqM"
httpRequest
- "user_id"
- Id of the user that
performs the request and "client_id"
- Id of the client for
which the access token is issued.
false - Resource access request fails. The passed token is not
available or expired for the current client. In this case the
error's reason can be retrieve from request's attributes with a
name "reason"
.
OAuthSystemException
- In case of communication errors between the OAuth Resource Server
and the Authorization Server.public abstract boolean isAuthorized(HttpServletRequest httpRequest, String scope) throws OAuthSystemException
"bearer"
.
For example the header could look like:
The given example is provided for illustration purposes only."Authorization: Bearer mF_9.B5f-4.1JqM"
httpRequest
- scope
- - Scope for which the protected resource access is performed"user_id"
- Id of the user that performs the request and
"client_id"
- Id of the client for which the access token
is issued.
false - Resource access request fails. In this case the error's
reason can be retrieve from request's attributes with a name
"reason"
.
OAuthSystemException
- In case of communication errors between the OAuth Resource Server
and the Authorization Server.public abstract boolean isAuthorized(String scope) throws OAuthSystemException
scope
- - Scope for which the protected resource access is performedfalse - Resource access request fails.
OAuthSystemException
- In case of communication errors between the OAuth Resource Server
and the Authorization Server.public abstract boolean isAuthorized(HttpServletRequest httpRequest, Set<String> scopes) throws OAuthSystemException
"bearer"
.
For example the header could look like:
The given example is provided for illustration purposes only."Authorization: Bearer mF_9.B5f-4.1JqM"
httpRequest
- scopes
- - Scopes for which the protected resource access is performed."user_id"
- Id of the user that performs the request and
"client_id"
- Id of the client for which the access token
is issued.
false - Resource access request fails. In this case the error's
reason can be retrieve from request's attributes with a name
"reason"
.
OAuthSystemException
- In case of communication errors between the OAuth Resource Server
and the Authorization Server.public abstract boolean isAuthorized(Set<String> scopes) throws OAuthSystemException
scopes
- - Scopes for which the protected resource access is performed.false - Resource access request fails.
OAuthSystemException
- In case of communication errors between the OAuth Resource Server
and the Authorization Server.Copyright © 2016 SAP. All Rights Reserved.