Author: prabath
Date: Wed Jan  9 11:30:13 2008
New Revision: 12083

Log:

OpenID integration

Modified:
   
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProvider.java
   
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/sts/OpenIDTokenIssuer.java

Modified: 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProvider.java
==============================================================================
--- 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProvider.java
     (original)
+++ 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProvider.java
     Wed Jan  9 11:30:13 2008
@@ -36,23 +36,24 @@
 
     // These are the constants used to represent attributes required by the
     // OpenID.
-    private final static String FIRST_NAME = "firstname";
-    private final static String LAST_NAME = "lastname";
     private final static String FULL_NAME = "fullname";
     private final static String NICK_NAME = "nickname";
+    private final static String GIVEN_NAME = "givenname";
+    private final static String SURNAME = "surname";
     private final static String EMAIL = "email";
-    private final static String PHONE = "phone";
+    private final static String HOME_PHONE = "phone";
+    private final static String WORK_PHONE = "phone";
+    private final static String MOBILE_PHONE = "phone";
     private final static String ADDRESS = "address";
     private final static String CITY = "city";
-    private final static String ZIP_CODE = "zipcode";
+    private final static String STATE = "state";
     private final static String COUNTRY = "country";
-    private final static String BLOG = "blog";
     private final static String TIMEZONE = "timezone";
     private final static String POSTAL_CODE = "postalcode";
     private final static String DOB = "dob";
     private final static String GENDER = "gender";
     private final static String LANGUAGE = "language";
-    
+
     private static String opAddress = null;
 
     /**
@@ -63,7 +64,7 @@
         ServerConfiguration serverConfig = null;
         String host = null;
         String httpsPort = null;
-    
+
         serverConfig = ServerConfiguration.getInstance();
         host = serverConfig.getFirstProperty("HostName");
         httpsPort = serverConfig.getFirstProperty("Ports.HTTPS");
@@ -104,8 +105,8 @@
             request = new ParameterList(httpReq.getParameterMap());
         }
 
-        String mode = request.hasParameter(IdentityConstants.OpenId.MODE) ? 
request
-                .getParameterValue(IdentityConstants.OpenId.MODE)
+        String mode = request.hasParameter(IdentityConstants.OpenId.ATTR_MODE) 
? request
+                .getParameterValue(IdentityConstants.OpenId.ATTR_MODE)
                 : null;
 
         if (IdentityConstants.OpenId.ASSOCIATE.equals(mode)) {
@@ -119,8 +120,9 @@
             String userSelectedClaimedId = null;
             String openId = null;
 
-            openId = request.hasParameter(IdentityConstants.OpenId.IDENTITY) ? 
request
-                    .getParameterValue(IdentityConstants.OpenId.IDENTITY)
+            openId = request
+                    .hasParameter(IdentityConstants.OpenId.ATTR_IDENTITY) ? 
request
+                    .getParameterValue(IdentityConstants.OpenId.ATTR_IDENTITY)
                     : null;
 
             // Authenticate the user.
@@ -146,10 +148,11 @@
             if (message instanceof DirectError)
                 return directResponse(httpResp, 
message.keyValueFormEncoding());
             else {
-                if (authReq.hasExtension(IdentityConstants.OpenId.NS_AX)) {
+                if (authReq
+                        
.hasExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX)) {
 
                     MessageExtension extensions = authReq
-                            .getExtension(IdentityConstants.OpenId.NS_AX);
+                            
.getExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX);
 
                     if (extensions instanceof FetchRequest) {
 
@@ -172,10 +175,11 @@
                         throw new UnsupportedOperationException("TODO");
                     }
                 }
-                if (authReq.hasExtension(IdentityConstants.OpenId.NS_SREG)) {
+                if (authReq
+                        
.hasExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG)) {
 
                     MessageExtension extension = authReq
-                            .getExtension(IdentityConstants.OpenId.NS_SREG);
+                            
.getExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG);
 
                     if (extension instanceof SRegRequest) {
 
@@ -237,10 +241,11 @@
         // An Identity Provider MAY return any subset of the following fields 
in
         // response to the query.
 
-        if 
(required.contains(IdentityConstants.OpenId.SimpleRegAttributes.EMAIL)) {
+        if (required
+                .contains(IdentityConstants.OpenId.SimpleRegAttributes.EMAIL)) 
{
             response.addAttribute(
-                    IdentityConstants.OpenId.SimpleRegAttributes.EMAIL, 
claimValues
-                            .get(EMAIL));
+                    IdentityConstants.OpenId.SimpleRegAttributes.EMAIL,
+                    claimValues.get(EMAIL));
         }
 
         if (required
@@ -257,7 +262,8 @@
                     claimValues.get(FULL_NAME));
         }
 
-        if 
(required.contains(IdentityConstants.OpenId.SimpleRegAttributes.COUNTRY)) {
+        if (required
+                
.contains(IdentityConstants.OpenId.SimpleRegAttributes.COUNTRY)) {
             response.addAttribute(
                     IdentityConstants.OpenId.SimpleRegAttributes.COUNTRY,
                     claimValues.get(COUNTRY));
@@ -271,22 +277,26 @@
         }
 
         if 
(required.contains(IdentityConstants.OpenId.SimpleRegAttributes.DOB)) {
-            
response.addAttribute(IdentityConstants.OpenId.SimpleRegAttributes.DOB,
+            response.addAttribute(
+                    IdentityConstants.OpenId.SimpleRegAttributes.DOB,
                     claimValues.get(DOB));
         }
-        if 
(required.contains(IdentityConstants.OpenId.SimpleRegAttributes.GENDER)) {
+        if (required
+                
.contains(IdentityConstants.OpenId.SimpleRegAttributes.GENDER)) {
             response.addAttribute(
-                    IdentityConstants.OpenId.SimpleRegAttributes.GENDER, 
claimValues
-                            .get(GENDER));
+                    IdentityConstants.OpenId.SimpleRegAttributes.GENDER,
+                    claimValues.get(GENDER));
         }
 
-        if 
(required.contains(IdentityConstants.OpenId.SimpleRegAttributes.LANGUAGE)) {
+        if (required
+                
.contains(IdentityConstants.OpenId.SimpleRegAttributes.LANGUAGE)) {
             response.addAttribute(
                     IdentityConstants.OpenId.SimpleRegAttributes.LANGUAGE,
                     claimValues.get(LANGUAGE));
         }
 
-        if 
(required.contains(IdentityConstants.OpenId.SimpleRegAttributes.TIMEZONE)) {
+        if (required
+                
.contains(IdentityConstants.OpenId.SimpleRegAttributes.TIMEZONE)) {
             response.addAttribute(
                     IdentityConstants.OpenId.SimpleRegAttributes.TIMEZONE,
                     claimValues.get(TIMEZONE));
@@ -310,75 +320,94 @@
         // required attributes.
         // If not, what to do is up to the caller..
 
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.EMAIL)) {
-            
response.addAttribute(IdentityConstants.OpenId.ExchangeAttributes.EMAIL,
-                    IdentityConstants.OpenId.ExchangeAttributes.EMAIL_NS, 
claimValues
-                            .get(EMAIL));
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.EMAIL)) {
+            response.addAttribute(
+                    IdentityConstants.OpenId.ExchangeAttributes.EMAIL,
+                    IdentityConstants.OpenId.ExchangeAttributes.EMAIL_NS,
+                    claimValues.get(EMAIL));
         }
 
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.ADDRESS)) {
-            
response.addAttribute(IdentityConstants.OpenId.ExchangeAttributes.ADDRESS,
-                    IdentityConstants.OpenId.ExchangeAttributes.ADDRESS_NS, 
claimValues
-                            .get(ADDRESS));
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.STREET_ADDRESS)) {
+            response
+                    .addAttribute(
+                            
IdentityConstants.OpenId.ExchangeAttributes.STREET_ADDRESS,
+                            
IdentityConstants.OpenId.ExchangeAttributes.STREET_ADDRESS_NS,
+                            claimValues.get(ADDRESS));
         }
 
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.CITY)) {
-            
response.addAttribute(IdentityConstants.OpenId.ExchangeAttributes.CITY,
-                    IdentityConstants.OpenId.ExchangeAttributes.CITY_NS, 
claimValues
-                            .get(CITY));
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.CITY)) {
+            response.addAttribute(
+                    IdentityConstants.OpenId.ExchangeAttributes.CITY,
+                    IdentityConstants.OpenId.ExchangeAttributes.CITY_NS,
+                    claimValues.get(CITY));
         }
 
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.COUNTRY)) {
-            
response.addAttribute(IdentityConstants.OpenId.ExchangeAttributes.COUNTRY,
-                    IdentityConstants.OpenId.ExchangeAttributes.COUNTRY_NS, 
claimValues
-                            .get(COUNTRY));
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.COUNTRY)) {
+            response.addAttribute(
+                    IdentityConstants.OpenId.ExchangeAttributes.COUNTRY,
+                    IdentityConstants.OpenId.ExchangeAttributes.COUNTRY_NS,
+                    claimValues.get(COUNTRY));
         }
 
         if (required
-                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.FIRST_NAME)) {
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.GIVEN_NAME)) {
             response.addAttribute(
-                    IdentityConstants.OpenId.ExchangeAttributes.FIRST_NAME,
-                    IdentityConstants.OpenId.ExchangeAttributes.FIRST_NAME_NS,
-                    claimValues.get(FIRST_NAME));
+                    IdentityConstants.OpenId.ExchangeAttributes.GIVEN_NAME,
+                    IdentityConstants.OpenId.ExchangeAttributes.GIVEN_NAME_NS,
+                    claimValues.get(GIVEN_NAME));
         }
 
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.LAST_NAME)) {
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.SURNAME)) {
             response.addAttribute(
-                    IdentityConstants.OpenId.ExchangeAttributes.LAST_NAME,
-                    IdentityConstants.OpenId.ExchangeAttributes.LAST_NAME_NS,
-                    claimValues.get(LAST_NAME));
+                    IdentityConstants.OpenId.ExchangeAttributes.SURNAME,
+                    IdentityConstants.OpenId.ExchangeAttributes.SURNAME_NS,
+                    claimValues.get(SURNAME));
         }
 
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.FULL_NAME)) {
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.HOME_PHONE)) {
             response.addAttribute(
-                    IdentityConstants.OpenId.ExchangeAttributes.FULL_NAME,
-                    IdentityConstants.OpenId.ExchangeAttributes.FULL_NAME_NS,
-                    claimValues.get(FULL_NAME));
+                    IdentityConstants.OpenId.ExchangeAttributes.HOME_PHONE,
+                    IdentityConstants.OpenId.ExchangeAttributes.HOME_PHONE_NS,
+                    claimValues.get(HOME_PHONE));
         }
 
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.NICK_NAME)) {
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.WORK_PHONE)) {
             response.addAttribute(
-                    IdentityConstants.OpenId.ExchangeAttributes.NICK_NAME,
-                    IdentityConstants.OpenId.ExchangeAttributes.NICK_NAME_NS,
-                    claimValues.get(NICK_NAME));
+                    IdentityConstants.OpenId.ExchangeAttributes.WORK_PHONE,
+                    IdentityConstants.OpenId.ExchangeAttributes.WORK_PHONE_NS,
+                    claimValues.get(WORK_PHONE));
         }
 
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.PHONE)) {
-            
response.addAttribute(IdentityConstants.OpenId.ExchangeAttributes.PHONE,
-                    IdentityConstants.OpenId.ExchangeAttributes.PHONE_NS, 
claimValues
-                            .get(PHONE));
-        }
-
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.ZIP_CODE)) {
-            
response.addAttribute(IdentityConstants.OpenId.ExchangeAttributes.ZIP_CODE,
-                    IdentityConstants.OpenId.ExchangeAttributes.ZIP_CODE_NS,
-                    claimValues.get(ZIP_CODE));
-        }
-
-        if 
(required.containsKey(IdentityConstants.OpenId.ExchangeAttributes.BLOG)) {
-            
response.addAttribute(IdentityConstants.OpenId.ExchangeAttributes.BLOG,
-                    IdentityConstants.OpenId.ExchangeAttributes.BLOG, 
claimValues
-                            .get(BLOG));
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.MOBILE_PHONE)) {
+            response
+                    .addAttribute(
+                            
IdentityConstants.OpenId.ExchangeAttributes.MOBILE_PHONE,
+                            
IdentityConstants.OpenId.ExchangeAttributes.MOBILE_PHONE_NS,
+                            claimValues.get(MOBILE_PHONE));
+        }
+
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.POSTAL_CODE)) {
+            response.addAttribute(
+                    IdentityConstants.OpenId.ExchangeAttributes.POSTAL_CODE,
+                    IdentityConstants.OpenId.ExchangeAttributes.POSTAL_CODE_NS,
+                    claimValues.get(POSTAL_CODE));
+        }
+
+        if (required
+                
.containsKey(IdentityConstants.OpenId.ExchangeAttributes.STATE)) {
+            response.addAttribute(
+                    IdentityConstants.OpenId.ExchangeAttributes.STATE,
+                    IdentityConstants.OpenId.ExchangeAttributes.STATE_NS,
+                    claimValues.get(STATE));
         }
 
     }
@@ -475,18 +504,18 @@
                         // first name
                         if (mapValues
                                 
.containsKey(IdentityConstants.CLAIM_GIVEN_NAME))
-                            claimValues.put(FIRST_NAME, (String) mapValues
+                            claimValues.put(GIVEN_NAME, (String) mapValues
                                     .get(IdentityConstants.CLAIM_GIVEN_NAME));
                         else
-                            claimValues.put(FIRST_NAME, "none");
+                            claimValues.put(GIVEN_NAME, "none");
 
                         // last name
                         if (mapValues
                                 .containsKey(IdentityConstants.CLAIM_SURNAME))
-                            claimValues.put(LAST_NAME, (String) mapValues
+                            claimValues.put(SURNAME, (String) mapValues
                                     .get(IdentityConstants.CLAIM_SURNAME));
                         else
-                            claimValues.put(LAST_NAME, "none");
+                            claimValues.put(SURNAME, "none");
 
                         // full name
                         if (mapValues
@@ -530,13 +559,29 @@
                         else
                             claimValues.put(EMAIL, "none");
 
-                        // phone
+                        // home phone
                         if (mapValues
                                 
.containsKey(IdentityConstants.CLAIM_HOME_PHONE))
-                            claimValues.put(PHONE, (String) mapValues
+                            claimValues.put(HOME_PHONE, (String) mapValues
                                     .get(IdentityConstants.CLAIM_HOME_PHONE));
                         else
-                            claimValues.put(PHONE, "none");
+                            claimValues.put(HOME_PHONE, "none");
+
+                        // work phone
+                        if (mapValues
+                                
.containsKey(IdentityConstants.CLAIM_WORK_PHONE))
+                            claimValues.put(WORK_PHONE, (String) mapValues
+                                    .get(IdentityConstants.CLAIM_WORK_PHONE));
+                        else
+                            claimValues.put(WORK_PHONE, "none");
+
+                        // mobile phone
+                        if (mapValues
+                                
.containsKey(IdentityConstants.CLAIM_MOBILE_PHONE))
+                            claimValues.put(MOBILE_PHONE, (String) mapValues
+                                    
.get(IdentityConstants.CLAIM_MOBILE_PHONE));
+                        else
+                            claimValues.put(MOBILE_PHONE, "none");
 
                         // address
                         if (mapValues
@@ -555,18 +600,21 @@
                                     .get(IdentityConstants.CLAIM_CITY));
                         else
                             claimValues.put(CITY, "none");
+                        
+                        // state
+                        if 
(mapValues.containsKey(IdentityConstants.CLAIM_STATE))
+                            claimValues.put(STATE, (String) mapValues
+                                    .get(IdentityConstants.CLAIM_STATE));
+                        else
+                            claimValues.put(STATE, "none");
 
                         // zipcode
                         if (mapValues
-                                
.containsKey(IdentityConstants.CLAIM_POSTAL_CODE)) {
-                            claimValues.put(ZIP_CODE, (String) mapValues
-                                    .get(IdentityConstants.CLAIM_POSTAL_CODE));
+                                
.containsKey(IdentityConstants.CLAIM_POSTAL_CODE))
                             claimValues.put(POSTAL_CODE, (String) mapValues
                                     .get(IdentityConstants.CLAIM_POSTAL_CODE));
-                        } else {
-                            claimValues.put(ZIP_CODE, "none");
+                        else
                             claimValues.put(POSTAL_CODE, "none");
-                        }
 
                         // country
                         if (mapValues
@@ -576,9 +624,6 @@
                         else
                             claimValues.put(COUNTRY, "none");
 
-                        // blog - currently we don't have a claim for this
-                        claimValues.put(BLOG, "none");
-
                         // TODO: Add values
                         claimValues.put(TIMEZONE, "none");
                         claimValues.put(DOB, "none");

Modified: 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/sts/OpenIDTokenIssuer.java
==============================================================================
--- 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/sts/OpenIDTokenIssuer.java
     (original)
+++ 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/sts/OpenIDTokenIssuer.java
     Wed Jan  9 11:30:13 2008
@@ -132,58 +132,218 @@
 
         params = new ParameterList();
 
-        params.set(new Parameter(IdentityConstants.OpenId.OP_NS,
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_NS,
                 IdentityConstants.OpenId.OPENID_URL));
 
-        params.set(new Parameter(IdentityConstants.OpenId.OP_ENDPOINT,
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_OP_ENDPOINT,
                 OpenIDProvider.getOpAddress()));
 
-        params.set(new Parameter(IdentityConstants.OpenId.CLAIM_ID,
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_CLAIM_ID,
                 ((RequestedClaimData) ipData.requestedClaims
-                        .get(IdentityConstants.OpenId.CLAIM_ID)).value));
+                        .get(IdentityConstants.CLAIM_OPENID)).value));
 
-        params.set(new Parameter(IdentityConstants.OpenId.RESPONSE_NONCE,
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_RESPONSE_NONCE,
                 "2007-12-14T09:25:50Z0"));
 
-        params.set(new Parameter(IdentityConstants.OpenId.MODE, "id_res"));
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_MODE, 
"id_res"));
 
-        params.set(new Parameter(IdentityConstants.OpenId.IDENTITY,
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_IDENTITY,
                 ((RequestedClaimData) ipData.requestedClaims
-                        .get(IdentityConstants.OpenId.CLAIM_ID)).value));
+                        .get(IdentityConstants.CLAIM_OPENID)).value));
 
-        params.set(new Parameter(IdentityConstants.OpenId.RETURN_TO,
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_RETURN_TO,
                 "https://openidcards.sxip.com/demorp/";));
 
-        params.set(new Parameter(IdentityConstants.OpenId.ASSOC_HANDLE,
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_ASSOC_HANDLE,
                 "e242741d76b42a6"));
         params
-                .set(new Parameter(IdentityConstants.OpenId.SIGNED,
+                .set(new Parameter(IdentityConstants.OpenId.ATTR_SIGNED,
                         
"op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle"));
 
-        params.set(new Parameter(IdentityConstants.OpenId.SIG,
+        params.set(new Parameter(IdentityConstants.OpenId.ATTR_SIG,
                 "ug3AMXHi6fnBDNk1ey0TyP+GI5o="));
 
-        params.set(new Parameter(IdentityConstants.OpenId.OP_SREG,
-                IdentityConstants.OpenId.NS_SREG));
+        params.set(new Parameter(
+                IdentityConstants.OpenId.ExchangeAttributes.EXT,
+                IdentityConstants.OpenId.ExchangeAttributes.NS_AX));
+
+        params.set(new Parameter(
+                IdentityConstants.OpenId.ExchangeAttributes.MODE,
+                IdentityConstants.OpenId.ExchangeAttributes.FETCH_RESPONSE));
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_SURNAME)) {
+
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.SURNAME,
+                            
IdentityConstants.OpenId.ExchangeAttributes.SURNAME_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.SURNAME,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_SURNAME)).value));
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_GIVEN_NAME)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.GIVEN_NAME,
+                            
IdentityConstants.OpenId.ExchangeAttributes.GIVEN_NAME_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.GIVEN_NAME,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_GIVEN_NAME)).value));
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_EMAIL_ADDRESS)) 
{
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.EMAIL,
+                            
IdentityConstants.OpenId.ExchangeAttributes.EMAIL_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.EMAIL,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_EMAIL_ADDRESS)).value));
+        }
+
+        if (ipData.requestedClaims
+                
.containsKey(IdentityProviderConstants.ATTR_NS_STREET_ADDRESS)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.STREET_ADDRESS,
+                            
IdentityConstants.OpenId.ExchangeAttributes.STREET_ADDRESS_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.STREET_ADDRESS,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_STREET_ADDRESS)).value));
+
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_CITY)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.CITY,
+                            
IdentityConstants.OpenId.ExchangeAttributes.CITY_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.CITY,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_CITY)).value));
+
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_STATE)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.STATE,
+                            
IdentityConstants.OpenId.ExchangeAttributes.STATE_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.STATE,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_STATE)).value));
+
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_POSTAL_CODE)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.POSTAL_CODE,
+                            
IdentityConstants.OpenId.ExchangeAttributes.POSTAL_CODE_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.POSTAL_CODE,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_POSTAL_CODE)).value));
+
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_COUNTRY)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.COUNTRY,
+                            
IdentityConstants.OpenId.ExchangeAttributes.COUNTRY_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.COUNTRY,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_COUNTRY)).value));
+
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_HOME_PHONE)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.HOME_PHONE,
+                            
IdentityConstants.OpenId.ExchangeAttributes.HOME_PHONE_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.HOME_PHONE,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_HOME_PHONE)).value));
+
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_WORK_PHONE)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.WORK_PHONE,
+                            
IdentityConstants.OpenId.ExchangeAttributes.WORK_PHONE_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.WORK_PHONE,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_WORK_PHONE)).value));
+
+        }
+
+        if (ipData.requestedClaims
+                .containsKey(IdentityProviderConstants.ATTR_NS_MOBILE_PHONE)) {
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.TYPE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.MOBILE_PHONE,
+                            
IdentityConstants.OpenId.ExchangeAttributes.MOBILE_PHONE_NS));
+            params
+                    .set(new Parameter(
+                            IdentityConstants.OpenId.ExchangeAttributes.VALUE
+                                    + 
IdentityConstants.OpenId.ExchangeAttributes.MOBILE_PHONE,
+                            ((RequestedClaimData) ipData.requestedClaims
+                                    
.get(IdentityProviderConstants.ATTR_NS_MOBILE_PHONE)).value));
 
-        params
-                .set(new Parameter(
-                        IdentityConstants.OpenId.SREG
-                                + 
IdentityConstants.OpenId.SimpleRegAttributes.FULL_NAME,
-                        ((RequestedClaimData) ipData.requestedClaims
-                                
.get(IdentityProviderConstants.ATTR_NS_SURNAME)).value));
-        params
-                .set(new Parameter(
-                        IdentityConstants.OpenId.SREG
-                                + 
IdentityConstants.OpenId.SimpleRegAttributes.NICK_NAME,
-                        ((RequestedClaimData) ipData.requestedClaims
-                                
.get(IdentityProviderConstants.ATTR_NS_GIVEN_NAME)).value));
-        params
-                .set(new Parameter(
-                        IdentityConstants.OpenId.SREG
-                                + 
IdentityConstants.OpenId.SimpleRegAttributes.EMAIL,
-                        ((RequestedClaimData) ipData.requestedClaims
-                                
.get(IdentityProviderConstants.ATTR_NS_EMAIL_ADDRESS)).value));
+        }
 
         message = Message.createMessage(params);
 

_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev

Reply via email to