Author: rbaxter85
Date: Wed Nov 20 00:32:32 2013
New Revision: 1543671
URL: http://svn.apache.org/r1543671
Log:
Factor out creation of the AnonymousSecurityToken into a separate method
SHINDIG-1950
Committed For Andreas Kohn
Modified:
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth2/OAuth2AuthenticationHandler.java
Modified:
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth2/OAuth2AuthenticationHandler.java
URL:
http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth2/OAuth2AuthenticationHandler.java?rev=1543671&r1=1543670&r2=1543671&view=diff
==============================================================================
---
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth2/OAuth2AuthenticationHandler.java
(original)
+++
shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth2/OAuth2AuthenticationHandler.java
Wed Nov 20 00:32:32 2013
@@ -68,7 +68,7 @@ public class OAuth2AuthenticationHandler
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
@@ -81,4 +81,17 @@ public class OAuth2AuthenticationHandler
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
+ }
}