You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2013/06/19 14:33:32 UTC

svn commit: r1494588 - /cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java

Author: sergeyb
Date: Wed Jun 19 12:33:31 2013
New Revision: 1494588

URL: http://svn.apache.org/r1494588
Log:
Minor update to get it simpler to register a single custom grant handler

Modified:
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java?rev=1494588&r1=1494587&r2=1494588&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java Wed Jun 19 12:33:31 2013
@@ -19,7 +19,7 @@
 
 package org.apache.cxf.rs.security.oauth2.services;
 
-import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 
 import javax.ws.rs.Consumes;
@@ -46,7 +46,7 @@ import org.apache.cxf.rs.security.oauth2
  */
 @Path("/token")
 public class AccessTokenService extends AbstractTokenService {
-    private List<AccessTokenGrantHandler> grantHandlers = Collections.emptyList();
+    private List<AccessTokenGrantHandler> grantHandlers = new LinkedList<AccessTokenGrantHandler>();
     
     /**
      * Sets the list of optional grant handlers
@@ -57,6 +57,14 @@ public class AccessTokenService extends 
     }
     
     /**
+     * Sets a grant handler
+     * @param handler the grant handler
+     */
+    public void setGrantHandler(AccessTokenGrantHandler handler) {
+        grantHandlers.add(handler);
+    }
+    
+    /**
      * Processes an access token request
      * @param params the form parameters representing the access token grant 
      * @return Access Token or the error