cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Updating Dynamic reg service to check if the user credentials have been provided
Date Thu, 09 Mar 2017 17:33:18 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes a0609adf1 -> ca9d6e1e8


Updating Dynamic reg service to check if the user credentials have been provided


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

Branch: refs/heads/3.1.x-fixes
Commit: ca9d6e1e89ea8007a86dde63c3da21f584ccbb46
Parents: a0609ad
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Mar 9 17:28:36 2017 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Mar 9 17:32:51 2017 +0000

----------------------------------------------------------------------
 .../oauth2/services/DynamicRegistrationService.java         | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ca9d6e1e/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 69d7f7b..3a6ed16 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
@@ -32,6 +32,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
+import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.core.UriBuilder;
 
 import org.apache.cxf.common.util.Base64UrlUtility;
@@ -39,6 +40,7 @@ import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth2.common.Client;
+import org.apache.cxf.rs.security.oauth2.common.UserSubject;
 import org.apache.cxf.rs.security.oauth2.provider.ClientRegistrationProvider;
 import org.apache.cxf.rs.security.oauth2.utils.AuthorizationUtils;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
@@ -260,7 +262,12 @@ public class DynamicRegistrationService {
         //TODO: check other properties
         // Add more typed properties like tosUri, policyUri, etc to Client
         // or set them as Client extra properties
-     
+        SecurityContext sc = mc.getSecurityContext();
+        if (sc != null && sc.getUserPrincipal() != null && sc.getUserPrincipal().getName()
!= null) {
+            UserSubject subject = new UserSubject(sc.getUserPrincipal().getName());
+            newClient.setResourceOwnerSubject(subject);
+        }
+        
         newClient.setRegisteredDynamically(true);
         return newClient;
     }


Mime
View raw message