cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [05/33] cxf git commit: [CXF-6692] Reporting a unique subject id if it is available
Date Sat, 13 Aug 2016 21:30:43 GMT
[CXF-6692] Reporting a unique subject id if it is available


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

Branch: refs/heads/master-jaxrs-2.1
Commit: 8c6d7f9871ad390581f97d084eaf0d45e344d2ed
Parents: 1bfdcba
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Tue Aug 9 13:12:39 2016 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Tue Aug 9 13:12:39 2016 +0100

----------------------------------------------------------------------
 .../oauth2/provider/AbstractOAuthDataProvider.java       | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/8c6d7f98/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
index 9b02d3b..e25fcb7 100644
--- a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
+++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/AbstractOAuthDataProvider.java
@@ -97,8 +97,15 @@ public abstract class AbstractOAuthDataProvider implements OAuthDataProvider,
Cl
         if (at.getExpiresIn() > 0) {
             claims.setExpiryTime(at.getIssuedAt() + at.getExpiresIn());
         }
-        if (at.getSubject() != null) {
-            claims.setSubject(at.getSubject().getLogin());
+        UserSubject userSubject = at.getSubject();
+        if (userSubject != null) {
+            if (userSubject.getId() != null) {
+                claims.setSubject(userSubject.getId());
+                claims.setClaim("preferred_username", userSubject.getLogin());
+            } else {
+                claims.setSubject(userSubject.getLogin());
+            }
+            
         }
         if (at.getIssuer() != null) {
             claims.setIssuer(at.getIssuer());


Mime
View raw message