Author: prabath
Date: Mon Jan 28 10:26:34 2008
New Revision: 13091

Log:

handles when user denies sending profile info

Modified:
   
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/openid/relyingparty/OpenIDConsumer.java

Modified: 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/openid/relyingparty/OpenIDConsumer.java
==============================================================================
--- 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/openid/relyingparty/OpenIDConsumer.java
      (original)
+++ 
trunk/solutions/identity/modules/token-verifier-core/src/main/java/org/wso2/solutions/identity/openid/relyingparty/OpenIDConsumer.java
      Mon Jan 28 10:26:34 2008
@@ -149,12 +149,21 @@
         String queryString = null;
         VerificationResult verification = null;
         AuthSuccess authSuccess = null;
+        String mode = null;
 
         try {
             // Extract the parameters from the authentication response
             // (which comes in as a HTTP request from the OpenID provider)
             response = new ParameterList(request.getParameterMap());
 
+            mode = response
+                    .getParameterValue(IdentityConstants.OpenId.ATTR_MODE);
+
+            if (IdentityConstants.OpenId.CANCEL.equals(mode))
+                // User has denied sending his profile info :(
+                throw new RelyingPartyException(
+                        
IdentityConstants.ErrorCodes.OPENID_AUTHENTICATION_FAILED);
+
             // Retrieve the previously stored discovery information.
             discovered = (DiscoveryInformation) request.getSession()
                     .getAttribute(IdentityConstants.OpenId.DISC);
@@ -301,7 +310,8 @@
                 mode = response
                         .getParameterValue(IdentityConstants.OpenId.ATTR_MODE);
 
-                if (IdentityConstants.OpenId.OPENOD_RESPONSE.equals(mode)) {
+                if (IdentityConstants.OpenId.OPENOD_RESPONSE.equals(mode)
+                        || IdentityConstants.OpenId.CANCEL.equals(mode)) {
                     return true;
                 } else {
                     return false;

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

Reply via email to