Author: prabath
Date: Mon Feb 11 23:56:37 2008
New Revision: 13619
Log:
comments
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDAuthVerificationAction.java
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDAuthenticationAction.java
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/OpenIDDownloadInfoCardAction.java
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDInfoCardLoginAction.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/OpenIDLoginAction.java
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDSelfIssuedLoginAction.java
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/OpenIDUserApprovalAction.java
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/UpdateOpenIDUserRPAction.java
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDAuthVerificationAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDAuthVerificationAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDAuthVerificationAction.java
Mon Feb 11 23:56:37 2008
@@ -7,12 +7,13 @@
import javax.servlet.http.HttpSession;
import org.openid4java.message.ParameterList;
-import org.openid4java.server.ServerException;
import org.apache.struts2.StrutsStatics;
import org.wso2.solutions.identity.IdentityProviderConstants;
+import org.wso2.solutions.identity.IdentityProviderException;
import org.wso2.solutions.identity.persistence.IPPersistenceManager;
import org.wso2.solutions.identity.persistence.dataobject.OpenIDUserRPDO;
+import org.wso2.solutions.identity.relyingparty.RelyingPartyException;
import org.wso2.solutions.identity.user.ui.util.UserUtil;
import com.opensymphony.xwork2.ActionContext;
@@ -25,7 +26,7 @@
private static final long serialVersionUID = 7880796322220751491L;
/**
- *
+ * This will get executed once the user provided his login credentials
*/
public String execute() throws Exception {
@@ -51,9 +52,11 @@
openID = requestParam.getParameter("openid.identity").getValue();
if (infoCardSignin != null && "Log in".equals(infoCardSignin)) {
-
- if (UserUtil.verifyInfoCardLogin(context,openID)) {
+ // User logs in with an information card
+ if (UserUtil.verifyInfoCardLogin(context, openID)) {
if (!isRequiredUserApproval(request)) {
+ // User has already agreed to accept request from this RP
+ // always.
response
.sendRedirect("server?_action=complete&authenticatedAndApproved=true");
}
@@ -62,16 +65,16 @@
this.addErrorMessage(getText("invalid_card_login"));
return ERROR;
}
-
} else {
-
+ // User logs in with user-name/password.
password = request
.getParameter(IdentityProviderConstants.OpenId.PASSWORD);
-
user = UserUtil.getUserName(openID);
if (UserUtil.doLogin(user, password)) {
if (!isRequiredUserApproval(request)) {
+ // User has already agreed to accept request from this RP
+ // always.
response
.sendRedirect("server?_action=complete&authenticatedAndApproved=true");
}
@@ -80,44 +83,51 @@
this.addErrorMessage(getText("invalid_user_password"));
return ERROR;
}
-
}
-
}
/**
+ * Check whether user has already agreed to accept request from this RP
+ * always
*
* @param request
* @return
- * @throws ServerException
- * @throws Exception
+ * @throws RelyingPartyException
*/
private boolean isRequiredUserApproval(HttpServletRequest request)
- throws ServerException, Exception {
+ throws RelyingPartyException {
ParameterList requestParam = null;
+ IPPersistenceManager db = null;
+
requestParam = (ParameterList) request.getSession().getAttribute(
"parameterlist");
-
String openID =
requestParam.getParameter("openid.identity").getValue();
String rpUrl = requestParam.getParameterValue("openid.return_to");
- IPPersistenceManager db = IPPersistenceManager.getPersistanceManager();
+ try {
+ db = IPPersistenceManager.getPersistanceManager();
+ } catch (IdentityProviderException e) {
+ throw new RelyingPartyException("dbConnectionFailure");
+ }
+
OpenIDUserRPDO[] rpdos = null;
OpenIDUserRPDO rpdo = null;
+ // Get matching data, related to the requested RP.
rpdos = db.getOpenIDUserRP(UserUtil.getUserName(openID), rpUrl);
if (rpdos != null && rpdos.length > 0) {
+ // User has already logged into this RP.
rpdo = rpdos[0];
if (rpdo.getIsTrustedAlways()) {
+ // User trusts this RP.
rpdo.setVisitCount(rpdo.getVisitCount() + 1);
rpdo.setLastVisit(new Date());
db.update(rpdo);
return false;
}
}
-
return true;
}
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDAuthenticationAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDAuthenticationAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDAuthenticationAction.java
Mon Feb 11 23:56:37 2008
@@ -5,7 +5,8 @@
private static final long serialVersionUID = 2379986821364538695L;
/**
- *
+ * This will get executed during the user's authentication to the OpenID
+ * Provider
*/
public String execute() throws Exception {
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
Mon Feb 11 23:56:37 2008
@@ -8,6 +8,7 @@
import com.opensymphony.xwork2.ActionSupport;
import org.wso2.solutions.identity.IdentityConstants;
+import org.wso2.solutions.identity.relyingparty.RelyingPartyException;
import org.wso2.solutions.identity.user.ui.UIConstants;
import org.wso2.solutions.identity.user.ui.util.UserUtil;
@@ -16,7 +17,8 @@
private static final long serialVersionUID = 8513265604523184916L;
/**
- *
+ * This will get executed after the user successfully authenticated to the
+ * OpenID Provider
*/
public String execute() throws Exception {
@@ -39,13 +41,12 @@
return ERROR;
// If this OpenID is not from WSO2 OP, we do not let him go in.
- // If this is from WSO2 OP, then user should be in our DB.
+ // If this is from WSO2 OP, then user should be in our DB.
userID = UserUtil.getUserName(openID);
-
// Set the logged in user's id.
map.put(UIConstants.USER, userID);
- } catch (Exception e) {
+ } catch (RelyingPartyException e) {
return ERROR;
}
return SUCCESS;
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDDownloadInfoCardAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDDownloadInfoCardAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDDownloadInfoCardAction.java
Mon Feb 11 23:56:37 2008
@@ -8,7 +8,7 @@
private static final long serialVersionUID = 5406684555050588740L;
/**
- *
+ * This will get executed during OpenID Information card download
*/
public String execute() throws Exception {
try {
@@ -19,12 +19,13 @@
}
/**
- *
+ * Overrides the base class method with the CardIssuer related to OpenID
+ * Information card
*/
protected CardIssuer getCardIssuer() throws IdentityProviderException {
CardIssuer issuer = new CardIssuer();
-
+
// We issue OpenIDInfoCards now - so our CardIssuer should support it.
issuer.setIsOpenIdInfoCard(true);
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDInfoCardLoginAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDInfoCardLoginAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDInfoCardLoginAction.java
Mon Feb 11 23:56:37 2008
@@ -7,7 +7,7 @@
private static final long serialVersionUID = 6703990413858353723L;
/**
- *
+ * This will get executed during OpenID Information card login
*/
public String execute() throws Exception {
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
Mon Feb 11 23:56:37 2008
@@ -17,7 +17,7 @@
private static final long serialVersionUID = 264026108621800214L;
/**
- *
+ * This will get executed once the OpenID Information card being submitted
*/
public String execute() throws Exception {
@@ -49,7 +49,6 @@
}
return SUCCESS;
-
}
}
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDLoginAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDLoginAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDLoginAction.java
Mon Feb 11 23:56:37 2008
@@ -7,7 +7,7 @@
private static final long serialVersionUID = 5467169583429456678L;
/**
- *
+ * This will get executed during OpenID login
*/
public String execute() throws Exception {
return SUCCESS;
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDSelfIssuedLoginAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDSelfIssuedLoginAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDSelfIssuedLoginAction.java
Mon Feb 11 23:56:37 2008
@@ -2,14 +2,17 @@
import com.opensymphony.xwork2.ActionSupport;
-public class OpenIDSelfIssuedLoginAction extends ActionSupport{
-
-
+public class OpenIDSelfIssuedLoginAction extends ActionSupport {
+
/**
*
*/
private static final long serialVersionUID = -2738763924536097318L;
+ /**
+ * This will get executed during self-issued information card login to
+ * OpenID Provider
+ */
public String execute() throws Exception {
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
Mon Feb 11 23:56:37 2008
@@ -4,7 +4,6 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.StrutsStatics;
import org.wso2.solutions.identity.IdentityConstants;
-import
org.wso2.solutions.identity.openid.infocard.OpenIDInfoCardProviderData.OpenIDRequestedClaimData;
import
org.wso2.solutions.identity.openid.relyingparty.OpenIDAuthenticationRequest;
import org.wso2.solutions.identity.openid.relyingparty.OpenIDConsumer;
import org.wso2.solutions.identity.openid.relyingparty.OpenIDRequestType;
@@ -20,7 +19,7 @@
private String openIdUrl;
/**
- *
+ * This will get executed once the OpenID user name/password submitted
*/
public String execute() throws Exception {
@@ -43,10 +42,12 @@
openIDAuthRequest.setReponse(response);
openIDAuthRequest.setRequest(request);
openIDAuthRequest.setOpenIDUrl(getOpenIdUrl());
-
-
openIDAuthRequest.setRequestType(OpenIDRequestType.SIMPLE_REGISTRATION);
- // Set the required claims - I need these claims from the OpenID
Provider.
+ openIDAuthRequest
+ .setRequestType(OpenIDRequestType.SIMPLE_REGISTRATION);
+
+ // Set the required claims - I need these claims from the OpenID
+ // Provider.
openIDAuthRequest
.addRequiredClaims(IdentityConstants.OpenId.SimpleRegAttributes.NICK_NAME);
openIDAuthRequest
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDUserApprovalAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDUserApprovalAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/OpenIDUserApprovalAction.java
Mon Feb 11 23:56:37 2008
@@ -10,7 +10,6 @@
import org.wso2.solutions.identity.IdentityConstants;
import org.wso2.solutions.identity.admin.RelyingPartyAdmin;
import org.wso2.solutions.identity.persistence.IPPersistenceManager;
-import org.wso2.solutions.identity.persistence.dao.OpenIDUserRPDAO;
import org.wso2.solutions.identity.persistence.dataobject.OpenIDUserRPDO;
import org.wso2.solutions.identity.user.ui.util.UserUtil;
@@ -24,6 +23,9 @@
*/
private static final long serialVersionUID = 2836760032315263963L;
+ /**
+ * This will get executed during user approval
+ */
public String execute() throws Exception {
ActionContext context = null;
HttpServletRequest request = null;
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/UpdateOpenIDUserRPAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/UpdateOpenIDUserRPAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/UpdateOpenIDUserRPAction.java
Mon Feb 11 23:56:37 2008
@@ -20,6 +20,9 @@
private String operation;
+ /**
+ * This will get executed while updating user visited relying Parties
+ */
public String execute() throws Exception {
if (rpUrl != null && operation != null && rpUrl.length() > 0
&& operation.length() > 0) {
@@ -45,7 +48,6 @@
db.update(rpdo);
}
-
}
return SUCCESS;
}
_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev