cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6692] Reporting a unique subject id if it is available
Date Tue, 09 Aug 2016 12:13:40 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes a0620f3e2 -> d9ddf0224


[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/d9ddf022
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d9ddf022
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d9ddf022

Branch: refs/heads/3.1.x-fixes
Commit: d9ddf02246f49511d29cda8e6458e5d28c4f861d
Parents: a0620f3
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:13:24 2016 +0100

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/d9ddf022/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 9e136f7..4a7b054 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