Class OAuthContextUtils
java.lang.Object
org.apache.cxf.rs.security.oauth2.utils.OAuthContextUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertClient(MessageContext mc, String client) static voidassertRole(MessageContext mc, String role) static OAuthContextstatic booleanisUserInRole(MessageContext mc, String role) static Stringstatic List<OAuthPermission>static Stringstatic Stringstatic String
-
Method Details
-
resolveUserId
- Parameters:
mc- theMessageContext- Returns:
- the id of the UserSubject of the logged in user or resource owner
- Throws:
WebApplicationException- with Status 401 if not authenticated
-
resolveUserName
- Parameters:
mc- theMessageContext- Returns:
- the name of the UserSubject of the logged in user or resource owner
- Throws:
WebApplicationException- with Status 401 if not authenticated
-
resolveUserRoles
- Parameters:
mc- theMessageContext- Returns:
- the list of roles of the logged in user or resource owner
- Throws:
WebApplicationException- with Status 401 if not authenticated
-
isUserInRole
- Parameters:
mc- theMessageContextrole- the user role to check- Returns:
- true if user has given role; false otherwise
- Throws:
WebApplicationException- with Status 401 if not authenticated
-
assertRole
- Parameters:
mc- theMessageContextrole- the role to check- Throws:
WebApplicationException- with Status 401 if not authenticatedWebApplicationException- with Status 403 if user doesn't have needed role
-
resolvePermissions
- Parameters:
mc- theMessageContext- Returns:
- the list of permissions of the used access token
- Throws:
WebApplicationException- with Status 401 if not authenticated
-
resolveTokenKey
- Parameters:
mc- theMessageContext- Returns:
- the token key used to access
- Throws:
WebApplicationException- with Status 401 if not authenticated
-
resolveClient
- Parameters:
mc- theMessageContext- Returns:
- the client registration id
- Throws:
WebApplicationException- with Status 401 if not authenticated
-
assertClient
- Parameters:
mc- theMessageContextclient- the desired client registration id- Throws:
WebApplicationException- with Status 403 if the current client id is not valid
-
getContext
- Parameters:
mc- theMessageContext- Returns:
- the
OAuthContextof the givenMessageContext - Throws:
WebApplicationException- with Status 401 if not authenticated
-