public final class OAuthContextUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
assertClient(MessageContext mc,
String client) |
static void |
assertRole(MessageContext mc,
String role) |
static OAuthContext |
getContext(MessageContext mc) |
static boolean |
isUserInRole(MessageContext mc,
String role) |
static String |
resolveClient(MessageContext mc) |
static List<OAuthPermission> |
resolvePermissions(MessageContext mc) |
static String |
resolveTokenKey(MessageContext mc) |
static String |
resolveUserId(MessageContext mc) |
static String |
resolveUserName(MessageContext mc) |
static List<String> |
resolveUserRoles(MessageContext mc) |
public static String resolveUserId(MessageContext mc)
mc
- the MessageContext
WebApplicationException
- with Status 401 if not authenticatedpublic static String resolveUserName(MessageContext mc)
mc
- the MessageContext
WebApplicationException
- with Status 401 if not authenticatedpublic static List<String> resolveUserRoles(MessageContext mc)
mc
- the MessageContext
WebApplicationException
- with Status 401 if not authenticatedpublic static boolean isUserInRole(MessageContext mc, String role)
mc
- the MessageContext
role
- the user role to checkWebApplicationException
- with Status 401 if not authenticatedpublic static void assertRole(MessageContext mc, String role)
mc
- the MessageContext
role
- the role to checkWebApplicationException
- with Status 401 if not authenticatedWebApplicationException
- with Status 403 if user doesn't have needed rolepublic static List<OAuthPermission> resolvePermissions(MessageContext mc)
mc
- the MessageContext
WebApplicationException
- with Status 401 if not authenticatedpublic static String resolveTokenKey(MessageContext mc)
mc
- the MessageContext
WebApplicationException
- with Status 401 if not authenticatedpublic static String resolveClient(MessageContext mc)
mc
- the MessageContext
WebApplicationException
- with Status 401 if not authenticatedpublic static void assertClient(MessageContext mc, String client)
mc
- the MessageContext
client
- the desired client registration idWebApplicationException
- with Status 403 if the current client id is not validpublic static OAuthContext getContext(MessageContext mc)
mc
- the MessageContext
OAuthContext
of the given MessageContext
WebApplicationException
- with Status 401 if not authenticatedApache CXF