Repository: cxf
Updated Branches:
  refs/heads/master 8d725cb89 -> 8d0e97762


Adding a 'resource_uris' extension prop to the OAuth2 dyn reg request


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8d0e9776
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8d0e9776
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8d0e9776

Branch: refs/heads/master
Commit: 8d0e9776201dcf2e53ae3a9bd004669c403266df
Parents: 8d725cb
Author: Sergey Beryozkin <sberyoz...@gmail.com>
Authored: Thu Dec 1 10:23:58 2016 +0000
Committer: Sergey Beryozkin <sberyoz...@gmail.com>
Committed: Thu Dec 1 10:23:58 2016 +0000

----------------------------------------------------------------------
 .../security/oauth2/services/ClientRegistration.java | 15 ++++++++++++++-
 .../oauth2/services/DynamicRegistrationService.java  |  9 +++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/8d0e9776/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ClientRegistration.java
----------------------------------------------------------------------
diff --git 
a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ClientRegistration.java
 
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ClientRegistration.java
index d81a623..ef933a2 100644
--- 
a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ClientRegistration.java
+++ 
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/ClientRegistration.java
@@ -38,7 +38,12 @@ public class ClientRegistration extends JsonMapObject {
     public static final String TOS_URI = "tos_uri";
     public static final String TOKEN_ENDPOINT_AUTH_METHOD = 
"token_endpoint_auth_method";
     public static final String SCOPE = OAuthConstants.SCOPE;
-        
+    // Extension - an array of resource audiences, the name is based on 
combining
+    // a property 'resource' (the resource indicators draft) and "_uris", 
similar to 
+    // a "redirect_uris" property. This property name may change in the future.
+    public static final String RESOURCE_URIS = "resource_uris";
+    
+    
     private static final long serialVersionUID = 7903976943604132150L;
 
     public ClientRegistration() {
@@ -54,6 +59,14 @@ public class ClientRegistration extends JsonMapObject {
     public List<String> getRedirectUris() {
         return getListStringProperty(REDIRECT_URIS);
     }
+    
+    public void setResourceUris(List<String> redirectUris) {
+        super.setProperty(RESOURCE_URIS, redirectUris);
+    }
+    public List<String> getResourceUris() {
+        return getListStringProperty(RESOURCE_URIS);
+    }
+    
     public void setResponseTypes(List<String> responseTypes) {
         super.setProperty(RESPONSE_TYPES, responseTypes);
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/8d0e9776/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java
----------------------------------------------------------------------
diff --git 
a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java
 
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java
index d8d5c59..8a8dd93 100644
--- 
a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java
+++ 
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/DynamicRegistrationService.java
@@ -160,6 +160,9 @@ public class DynamicRegistrationService {
         if (c.getApplicationLogoUri() != null) {
             reg.setLogoUri(c.getApplicationLogoUri());
         }
+        if (!c.getRegisteredAudiences().isEmpty()) {
+            reg.setResourceUris(c.getRegisteredAudiences());
+        }
         //etc
         return reg;
     }
@@ -230,6 +233,12 @@ public class DynamicRegistrationService {
             newClient.setRedirectUris(redirectUris);
         }
         
+        // Client Resource Audience URIs
+        List<String> resourceUris = request.getResourceUris();
+        if (resourceUris != null) {
+            newClient.setRegisteredAudiences(resourceUris);
+        }
+        
         // Client Scopes
         String scope = request.getScope();
         if (!StringUtils.isEmpty(scope)) {

Reply via email to