Skip to content

Commit

Permalink
Factor out creation of the AnonymousSecurityToken into a separate method
Browse files Browse the repository at this point in the history
SHINDIG-1950
Committed For Andreas Kohn

git-svn-id: https://svn.apache.org/repos/asf/shindig/trunk@1543671 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ryanjbaxter committed Nov 20, 2013
1 parent 2ff2b0d commit 2957f49
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public SecurityToken getSecurityTokenFromRequest(HttpServletRequest request)
try {
if (normalizedReq.getAccessToken() != null) {
store.validateRequestForResource(normalizedReq, null);
return new AnonymousSecurityToken(); // Return your valid security token
return createSecurityTokenForValidatedRequest(normalizedReq);
}
} catch (OAuth2Exception oae) {
// TODO (Eric): process OAuth2Exception properly
Expand All @@ -81,4 +81,17 @@ public String getWWWAuthenticateHeader(String realm) {
return String.format("Bearer realm=\"%s\"", realm);
}

/**
* Return a security token for the request.
*
* The request was validated against the {@link OAuth2Service}.
*
* @param request
* @return the security token for the request
* @throws InvalidAuthenticationException if the token can not be created
*/
protected SecurityToken createSecurityTokenForValidatedRequest(OAuth2NormalizedRequest request)
throws InvalidAuthenticationException {
return new AnonymousSecurityToken(); // Return your valid security token
}
}

0 comments on commit 2957f49

Please sign in to comment.