Author: prabath
Date: Mon Apr  7 12:34:53 2008
New Revision: 15608

Log:

post only when there is more than one extension present

Modified:
   
branches/solutions/identity/1.5/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProvider.java

Modified: 
branches/solutions/identity/1.5/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProvider.java
==============================================================================
--- 
branches/solutions/identity/1.5/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProvider.java
   (original)
+++ 
branches/solutions/identity/1.5/solutions/identity/modules/identity-provider/src/main/java/org/wso2/solutions/identity/openid/OpenIDProvider.java
   Mon Apr  7 12:34:53 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;
@@ -37,6 +32,7 @@
 import org.openid4java.message.MessageException;
 import org.openid4java.message.MessageExtension;
 import org.openid4java.message.ParameterList;
+import org.openid4java.message.sreg.SRegMessage;
 import org.openid4java.server.ServerException;
 import org.openid4java.server.ServerManager;
 import org.wso2.solutions.identity.IdentityConstants;
@@ -287,6 +283,7 @@
             req.setAuthRequest(authReq);
 
             boolean hasExtension = false;
+            boolean hasSregExtension = false;
 
             for (Object alias : authReq.getExtensions()) {
                 if (log.isDebugEnabled())
@@ -302,13 +299,22 @@
                         message.addExtension(messageExtension);
                         AuthSuccess authSuccess = (AuthSuccess) message;
                         authSuccess.setSignExtension((String) alias);
-                        hasExtension = true;
+
+                        if ((messageExtension instanceof SRegMessage)
+                                && req
+                                        .getExtensionAlias()
+                                        .equals(
+                                                
IdentityConstants.OpenId.SimpleRegAttributes.NS_SREG)) {
+                            hasSregExtension = true;
+                        } else {
+                            hasExtension = true;
+                        }
                         manager.sign(authSuccess);
                     }
                 }
             }
 
-            if (!hasExtension) {
+            if (hasSregExtension && !hasExtension) {
                 return message.getDestinationUrl(true);
             }
 

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

Reply via email to