Author: prabath
Date: Thu Apr  3 04:22:56 2008
New Revision: 15518

Log:

openid4java updated to rev 404 : minor changes to suit this version

Modified:
   
trunk/solutions/identity/modules/base/src/main/java/org/wso2/solutions/identity/IdentityConstants.java
   
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDExtensionFactory.java
   
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/extensions/OpenIDAttributeExchange.java
   
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/extensions/OpenIDSimpleReg.java
   
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/OpenIDExtensionFactory.java
   
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/extensions/OpenIDAttributeExchange.java
   
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/extensions/OpenIDSimpleReg.java

Modified: 
trunk/solutions/identity/modules/base/src/main/java/org/wso2/solutions/identity/IdentityConstants.java
==============================================================================
--- 
trunk/solutions/identity/modules/base/src/main/java/org/wso2/solutions/identity/IdentityConstants.java
      (original)
+++ 
trunk/solutions/identity/modules/base/src/main/java/org/wso2/solutions/identity/IdentityConstants.java
      Thu Apr  3 04:22:56 2008
@@ -176,6 +176,7 @@
                        // response when "openid.mode" is "id_res"
 
                        public final static String NS_SREG = 
"http://openid.net/sreg/1.0";;
+                       public final static String NS_SREG_1 = 
"http://openid.net/extensions/sreg/1.1";;
                        public final static String SREG = "openid.sreg.";
                        public final static String OP_SREG = "openid.ns.sreg";
 

Modified: 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDExtensionFactory.java
==============================================================================
--- 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDExtensionFactory.java
     (original)
+++ 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDExtensionFactory.java
     Thu Apr  3 04:22:56 2008
@@ -1,17 +1,12 @@
 /*
- * Copyright 2005-2008 WSO2, Inc. (http://wso2.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Copyright 2005-2008 WSO2, Inc. (http://wso2.com) Licensed under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 
 package org.wso2.solutions.identity.openid;
@@ -51,14 +46,18 @@
      * @return Appropriate OpenIDExtension instance
      */
     public OpenIDExtension getExtension(OpenIDAuthenticationRequest request) {
-        
+
         String alias = request.getExtensionAlias();
 
-        if (alias.equals(AxMessage.OPENID_NS_AX)) {
+        if (alias.equals(AxMessage.OPENID_NS_AX)
+                || alias
+                        
.equals(IdentityConstants.OpenId.ExchangeAttributes.NS_AX)) {
             return new OpenIDAttributeExchange(request);
         } else if (alias
                 .equals(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG)
-                || alias.equals(SRegMessage.OPENID_NS_SREG)) {
+                || alias.equals(SRegMessage.OPENID_NS_SREG)
+                || alias
+                        
.equals(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG_1)) {
             return new OpenIDSimpleReg(request);
         } else if (alias.equals(PapeMessage.OPENID_NS_PAPE)) {
             return new OpenIDPape(request);

Modified: 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/extensions/OpenIDAttributeExchange.java
==============================================================================
--- 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/extensions/OpenIDAttributeExchange.java
 (original)
+++ 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/extensions/OpenIDAttributeExchange.java
 Thu Apr  3 04:22:56 2008
@@ -1,17 +1,12 @@
 /*
- * Copyright 2005-2008 WSO2, Inc. (http://wso2.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Copyright 2005-2008 WSO2, Inc. (http://wso2.com) Licensed under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 
 package org.wso2.solutions.identity.openid.extensions;
@@ -61,7 +56,14 @@
 
         try {
             authRequest = request.getAuthRequest();
-            extensions = authRequest.getExtension(FetchRequest.OPENID_NS_AX);
+
+            if (authRequest.hasExtension(FetchRequest.OPENID_NS_AX))
+                extensions = authRequest
+                        .getExtension(FetchRequest.OPENID_NS_AX);
+            else if (authRequest
+                    
.hasExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX))
+                extensions = authRequest
+                        
.getExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX);
 
             if (extensions instanceof FetchRequest) {
                 Map required = null;
@@ -147,7 +149,13 @@
 
         try {
             authRequest = request.getAuthRequest();
-            extensions = authRequest.getExtension(FetchRequest.OPENID_NS_AX);
+            if (authRequest.hasExtension(FetchRequest.OPENID_NS_AX))
+                extensions = authRequest
+                        .getExtension(FetchRequest.OPENID_NS_AX);
+            else if (authRequest
+                    
.hasExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX))
+                extensions = authRequest
+                        
.getExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX);
 
             if (extensions instanceof FetchRequest) {
 

Modified: 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/extensions/OpenIDSimpleReg.java
==============================================================================
--- 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/extensions/OpenIDSimpleReg.java
 (original)
+++ 
trunk/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/extensions/OpenIDSimpleReg.java
 Thu Apr  3 04:22:56 2008
@@ -53,11 +53,16 @@
         try {
 
             authRequest = request.getAuthRequest();
-            extension = authRequest.getExtension(SRegRequest.OPENID_NS_SREG);
 
-            if (extension == null)
+            if (authRequest.hasExtension(SRegRequest.OPENID_NS_SREG))
+                extension = authRequest
+                        .getExtension(SRegRequest.OPENID_NS_SREG);
+            else 
if(authRequest.hasExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG))
                 extension = authRequest
                         
.getExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG);
+            else 
if(authRequest.hasExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG_1))
+                extension = authRequest
+                        
.getExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG_1);
 
             if (extension instanceof SRegRequest) {
 
@@ -122,11 +127,16 @@
 
         try {
             authRequest = request.getAuthRequest();
-            extension = authRequest.getExtension(SRegRequest.OPENID_NS_SREG);
-
-            if (extension == null)
+            
+            if (authRequest.hasExtension(SRegRequest.OPENID_NS_SREG))
+                extension = authRequest
+                        .getExtension(SRegRequest.OPENID_NS_SREG);
+            else 
if(authRequest.hasExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG))
                 extension = authRequest
                         
.getExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG);
+            else 
if(authRequest.hasExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG_1))
+                extension = authRequest
+                        
.getExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG_1);
 
             if (log.isDebugEnabled()) {
                 if (extension == null)

Modified: 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/OpenIDExtensionFactory.java
==============================================================================
--- 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/OpenIDExtensionFactory.java
      (original)
+++ 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/OpenIDExtensionFactory.java
      Thu Apr  3 04:22:56 2008
@@ -1,17 +1,12 @@
 /*
- * Copyright 2005-2008 WSO2, Inc. (http://wso2.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Copyright 2005-2008 WSO2, Inc. (http://wso2.com) Licensed under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 
 package org.wso2.solutions.identity.relyingparty.openid;
@@ -72,11 +67,15 @@
      */
     public OpenIDExtension getExtension(String alias, AuthSuccess auth) {
 
-        if (alias.equals(AxMessage.OPENID_NS_AX)) {
+        if (alias.equals(AxMessage.OPENID_NS_AX)
+                || alias
+                        
.equals(IdentityConstants.OpenId.ExchangeAttributes.NS_AX)) {
             return new OpenIDAttributeExchange(auth);
         } else if (alias
                 .equals(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG)
-                || alias.equals(SRegMessage.OPENID_NS_SREG)) {
+                || alias.equals(SRegMessage.OPENID_NS_SREG)
+                || alias
+                        
.equals(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG_1)) {
             return new OpenIDSimpleReg(auth);
         } else if (alias.equals(PapeMessage.OPENID_NS_PAPE)) {
             return new OpenIDPape(auth);

Modified: 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/extensions/OpenIDAttributeExchange.java
==============================================================================
--- 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/extensions/OpenIDAttributeExchange.java
  (original)
+++ 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/extensions/OpenIDAttributeExchange.java
  Thu Apr  3 04:22:56 2008
@@ -1,17 +1,12 @@
 /*
- * Copyright 2005-2008 WSO2, Inc. (http://wso2.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Copyright 2005-2008 WSO2, Inc. (http://wso2.com) Licensed under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 
 package org.wso2.solutions.identity.relyingparty.openid.extensions;
@@ -124,6 +119,20 @@
                                 .get(alias)), (String) values.get(0));
                     }
                 }
+            } else if (authSuccess
+                    
.hasExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX)) {
+                fetchReponse = (FetchResponse) authSuccess
+                        
.getExtension(IdentityConstants.OpenId.ExchangeAttributes.NS_AX);
+                aliases = fetchReponse.getAttributeAliases();
+                attributeTypes = fetchReponse.getAttributeTypes();
+
+                for (Object alias : aliases) {
+                    values = fetchReponse.getAttributeValues((String) alias);
+                    if (values != null && !values.isEmpty()) {
+                        request.setAttribute(getAlias((String) attributeTypes
+                                .get(alias)), (String) values.get(0));
+                    }
+                }
             }
         } catch (MessageException e) {
             throw new RelyingPartyException(

Modified: 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/extensions/OpenIDSimpleReg.java
==============================================================================
--- 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/extensions/OpenIDSimpleReg.java
  (original)
+++ 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/relyingparty/openid/extensions/OpenIDSimpleReg.java
  Thu Apr  3 04:22:56 2008
@@ -1,17 +1,12 @@
 /*
- * Copyright 2005-2008 WSO2, Inc. (http://wso2.com)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Copyright 2005-2008 WSO2, Inc. (http://wso2.com) Licensed under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
  */
 
 package org.wso2.solutions.identity.relyingparty.openid.extensions;
@@ -107,6 +102,10 @@
                 sregResp = (SRegResponse) authSuccess
                         
.getExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG);
 
+            }else if (authSuccess
+                    
.hasExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG_1)) {
+                sregResp = (SRegResponse) authSuccess
+                        
.getExtension(IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG_1);
             }
 
             if (sregResp != null) {

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

Reply via email to