Author: prabath
Date: Thu Jan 24 05:17:05 2008
New Revision: 12832
Log:
input validations and exception handling
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDCallbackAction.java
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDInfoCardSubmitAction.java
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDSubmitAction.java
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDCallbackAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDCallbackAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDCallbackAction.java
Thu Jan 24 05:17:05 2008
@@ -32,14 +32,18 @@
.get(StrutsStatics.HTTP_REQUEST);
map = ActionContext.getContext().getSession();
- openID = (String)
request.getAttribute(IdentityConstants.OpenId.OPENID_IDENTIFIER);
+ openID = (String) request
+ .getAttribute(IdentityConstants.OpenId.OPENID_IDENTIFIER);
+
+ if (openID == null)
+ return ERROR;
userID = UserUtil.getUserName(openID);
+ // Set the logged in user's id.
map.put(UIConstants.USER, userID);
} catch (Exception e) {
-
return ERROR;
}
return SUCCESS;
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDInfoCardSubmitAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDInfoCardSubmitAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDInfoCardSubmitAction.java
Thu Jan 24 05:17:05 2008
@@ -33,17 +33,21 @@
.get(StrutsStatics.HTTP_REQUEST);
map = ActionContext.getContext().getSession();
- openID = (String)
request.getAttribute(IdentityConstants.OpenId.OPENID_IDENTIFIER);
+ openID = (String) request
+ .getAttribute(IdentityConstants.OpenId.OPENID_IDENTIFIER);
+
+ if (openID == null)
+ return ERROR;
userID = UserUtil.getUserName(openID);
+ // Set the logged in user's id.
map.put(UIConstants.USER, userID);
} catch (Exception e) {
-
return ERROR;
}
-
+
return SUCCESS;
}
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDSubmitAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDSubmitAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDSubmitAction.java
Thu Jan 24 05:17:05 2008
@@ -3,8 +3,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.StrutsStatics;
+import org.wso2.solutions.identity.IdentityConstants;
import
org.wso2.solutions.identity.openid.relyingparty.OpenIDAuthenticationRequest;
import org.wso2.solutions.identity.openid.relyingparty.OpenIDConsumer;
+import org.wso2.solutions.identity.relyingparty.RelyingPartyException;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
@@ -34,17 +36,37 @@
request = (HttpServletRequest) context
.get(StrutsStatics.HTTP_REQUEST);
-
+
openIDAuthRequest = new OpenIDAuthenticationRequest();
openIDAuthRequest.setReponse(response);
openIDAuthRequest.setRequest(request);
openIDAuthRequest.setOpenIDUrl(getOpenIdUrl());
+ // Set the required claims - I need these claims from the OpenID
Provider.
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.NICK_NAME);
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.FULL_NAME);
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.EMAIL);
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.DOB);
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.GENDER);
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.POSTAL_CODE);
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.COUNTRY);
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.LANGUAGE);
+ openIDAuthRequest
+
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.TIMEZONE);
+
consumer = OpenIDConsumer.getInstance();
consumer.doOpenIDAuthentication(openIDAuthRequest);
-
- } catch (Exception e) {
+
+ } catch (RelyingPartyException e) {
return ERROR;
}
_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev