* @param mc the {@link MessageContext}
* @return the {@link OAuthContext} of the given {@link MessageContext}
* @throws WebApplicationException with Status 401 if not authenticated
*/
public static OAuthContext getContext(final MessageContext mc) {
final OAuthContext oauth = mc.getContent(OAuthContext.class);
if ((oauth == null) || (oauth.getSubject() == null) || (oauth.getSubject().getLogin() == null)) {
throw ExceptionUtils.toNotAuthorizedException(null, null);
}
return oauth;
}