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-6487] Adding more token properties
Date Fri, 24 Jul 2015 12:51:13 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 4f7948dd0 -> 2d5182d71


[CXF-6487] Adding more token properties


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

Branch: refs/heads/master
Commit: 2d5182d710bba26d0a042b2cb8ade7d3ce6f7741
Parents: 4f7948d
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Jul 24 15:50:57 2015 +0300
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Jul 24 15:50:57 2015 +0300

----------------------------------------------------------------------
 .../cxf/rs/security/oidc/common/IdToken.java    |  2 +-
 .../rs/security/oidc/common/UserAddress.java    | 21 +++++
 .../cxf/rs/security/oidc/common/UserInfo.java   | 84 ++++++++++++++++++++
 .../oidc/rp/OidcClientCodeRequestFilter.java    | 14 ++++
 4 files changed, 120 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/2d5182d7/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/IdToken.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/IdToken.java
b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/IdToken.java
index aaee746..ed5f7f4 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/IdToken.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/IdToken.java
@@ -24,7 +24,7 @@ import java.util.Map;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
 
-public class IdToken extends JwtClaims {
+public class IdToken extends UserInfo {
     public static final String AUTH_TIME_CLAIM = "auth_time";
     public static final String NONCE_CLAIM = "nonce";
     public static final String ACR_CLAIM = "acr";

http://git-wip-us.apache.org/repos/asf/cxf/blob/2d5182d7/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserAddress.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserAddress.java
b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserAddress.java
index 46c4d96..f3953d0 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserAddress.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserAddress.java
@@ -24,8 +24,11 @@ import org.apache.cxf.jaxrs.provider.json.JsonMapObject;
 
 public class UserAddress extends JsonMapObject {
     public static final String STREET = "street_address";
+    public static final String POSTCODE = "postal_address";
     public static final String LOCALITY = "locality";
     public static final String COUNTRY = "country";
+    public static final String REGION = "region";
+    public static final String FORMATTED = "formatted";
     
     public UserAddress() {
     }
@@ -40,6 +43,12 @@ public class UserAddress extends JsonMapObject {
     public String getStreet() {
         return (String)getProperty(STREET);
     }
+    public void setPostalCode(String name) {
+        setProperty(POSTCODE, name);
+    }
+    public String getPostalCode() {
+        return (String)getProperty(POSTCODE);
+    }
     public void setLocality(String name) {
         setProperty(LOCALITY, name);
     }
@@ -52,4 +61,16 @@ public class UserAddress extends JsonMapObject {
     public String getCountry() {
         return (String)getProperty(COUNTRY);
     }
+    public void setRegion(String name) {
+        setProperty(REGION, name);
+    }
+    public String getRegion() {
+        return (String)getProperty(REGION);
+    }
+    public void setFormatted(String name) {
+        setProperty(FORMATTED, name);
+    }
+    public String getFormatted() {
+        return (String)getProperty(FORMATTED);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2d5182d7/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserInfo.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserInfo.java
b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserInfo.java
index eae6614..14278fd 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserInfo.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/common/UserInfo.java
@@ -25,12 +25,24 @@ import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
 
 public class UserInfo extends JwtClaims {
     public static final String NAME_CLAIM = "name";
+    public static final String GIVEN_NAME_CLAIM = "given_name";
+    public static final String FAMILY_NAME_CLAIM = "family_name";
+    public static final String MIDDLE_NAME_CLAIM = "middle_name";
+    public static final String NICKNAME_CLAIM = "nickname";
+    public static final String PREFERRED_USERNAME_CLAIM = "preferred_username";
     public static final String PROFILE_CLAIM = "profile";
+    public static final String PICTURE_CLAIM = "picture";
+    public static final String WEBSITE_CLAIM = "website";
     public static final String EMAIL_CLAIM = "email";
     public static final String EMAIL_VERIFIED_CLAIM = "email_verified";
+    public static final String GENDER_CLAIM = "gender";
+    public static final String ZONEINFO_CLAIM = "zoneinfo";
+    public static final String LOCALE_CLAIM = "locale";
     public static final String BIRTHDATE_CLAIM = "birthdate";
     public static final String PHONE_CLAIM = "phone_number";
+    public static final String PHONE_VERIFIED_CLAIM = "phone_number_verified";
     public static final String ADDRESS_CLAIM = "address";
+    public static final String UPDATED_AT_CLAIM = "updated_at";
     public UserInfo() {
     }
     public UserInfo(JwtClaims claims) {
@@ -46,12 +58,72 @@ public class UserInfo extends JwtClaims {
     public String getName() {
         return (String)getProperty(NAME_CLAIM);
     }
+    public void setGivenName(String name) {
+        setProperty(GIVEN_NAME_CLAIM, name);
+    }
+    public String getGivenName() {
+        return (String)getProperty(GIVEN_NAME_CLAIM);
+    }
+    public void setFamilyName(String name) {
+        setProperty(FAMILY_NAME_CLAIM, name);
+    }
+    public String getFamilyName() {
+        return (String)getProperty(FAMILY_NAME_CLAIM);
+    }
+    public void setMiddleName(String name) {
+        setProperty(MIDDLE_NAME_CLAIM, name);
+    }
+    public String getMiddleName() {
+        return (String)getProperty(MIDDLE_NAME_CLAIM);
+    }
+    public void setNickName(String name) {
+        setProperty(NICKNAME_CLAIM, name);
+    }
+    public String getNickName() {
+        return (String)getProperty(NICKNAME_CLAIM);
+    }
+    public void setPreferredUserName(String name) {
+        setProperty(PREFERRED_USERNAME_CLAIM, name);
+    }
+    public String getPreferredUserName() {
+        return (String)getProperty(PREFERRED_USERNAME_CLAIM);
+    }
     public void setProfile(String name) {
         setProperty(PROFILE_CLAIM, name);
     }
     public String getProfile() {
         return (String)getProperty(PROFILE_CLAIM);
     }
+    public void setPicture(String name) {
+        setProperty(PICTURE_CLAIM, name);
+    }
+    public String getPicture() {
+        return (String)getProperty(PICTURE_CLAIM);
+    }
+    public void setWebsite(String name) {
+        setProperty(WEBSITE_CLAIM, name);
+    }
+    public String getWebsite() {
+        return (String)getProperty(WEBSITE_CLAIM);
+    }
+    public void setGender(String name) {
+        setProperty(GENDER_CLAIM, name);
+    }
+    public String getGender() {
+        return (String)getProperty(GENDER_CLAIM);
+    }
+    public void setZoneInfo(String name) {
+        setProperty(ZONEINFO_CLAIM, name);
+    }
+    public String getZoneInfo() {
+        return (String)getProperty(ZONEINFO_CLAIM);
+    }
+    public void setLocale(String name) {
+        setProperty(LOCALE_CLAIM, name);
+    }
+    public String getLocale() {
+        return (String)getProperty(LOCALE_CLAIM);
+    }
     public void setEmail(String name) {
         setProperty(EMAIL_CLAIM, name);
     }
@@ -76,6 +148,12 @@ public class UserInfo extends JwtClaims {
     public void setPhoneNumber(String name) {
         setProperty(PHONE_CLAIM, name);
     }
+    public void setPhoneVerified(Boolean verified) {
+        setProperty(PHONE_VERIFIED_CLAIM, verified);
+    }
+    public Boolean getPhoneVerified() {
+        return getBooleanProperty(PHONE_VERIFIED_CLAIM);
+    }
     public UserAddress getUserAddress() {
         Object value = getProperty(ADDRESS_CLAIM);
         if (value instanceof UserAddress) {
@@ -90,5 +168,11 @@ public class UserInfo extends JwtClaims {
     public void setUserAddressNumber(UserAddress address) {
         setProperty(ADDRESS_CLAIM, address);
     }
+    public void setUpdatedAt(Long time) {
+        setProperty(UPDATED_AT_CLAIM, time);
+    }
+    public Long getUpdatedAt() {
+        return getLongProperty(UPDATED_AT_CLAIM);
+    }
     
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/2d5182d7/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
index c43e7f0..6406e3b 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
@@ -44,6 +44,8 @@ public class OidcClientCodeRequestFilter extends ClientCodeRequestFilter
{
     private List<String> authenticationContextRef;
     private String promptLogin;
     private Long maxAgeOffset;
+    private String claims;
+    private String claimsLocales;
     
     public void setAuthenticationContextRef(String acr) {
         this.authenticationContextRef = Arrays.asList(StringUtils.split(acr, " "));
@@ -114,6 +116,12 @@ public class OidcClientCodeRequestFilter extends ClientCodeRequestFilter
{
     }
     @Override
     protected void setAdditionalCodeRequestParams(UriBuilder ub, MultivaluedMap<String,
String> redirectState) {
+        if (claims != null) {
+            ub.queryParam("claims", claims);
+        }
+        if (claimsLocales != null) {
+            ub.queryParam("claims_locales", claimsLocales);
+        }
         if (redirectState != null) {
             if (redirectState.getFirst(IdToken.NONCE_CLAIM) != null) {
                 ub.queryParam(IdToken.NONCE_CLAIM, redirectState.getFirst(IdToken.NONCE_CLAIM));
@@ -140,4 +148,10 @@ public class OidcClientCodeRequestFilter extends ClientCodeRequestFilter
{
     public void setMaxAgeOffset(Long maxAgeOffset) {
         this.maxAgeOffset = maxAgeOffset;
     }
+    public void setClaims(String claims) {
+        this.claims = claims;
+    }
+    public void setClaimsLocales(String claimsLocales) {
+        this.claimsLocales = claimsLocales;
+    }
 }


Mime
View raw message