Author: prabath
Date: Sat Jan 5 22:17:19 2008
New Revision: 11878
Log:
OpenID integration
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/DownloadInfoCardAction.java
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/ShowMainAction.java
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/UserRegistrationFormSubmitAction.java
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/DownloadInfoCardAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/DownloadInfoCardAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/DownloadInfoCardAction.java
Sat Jan 5 22:17:19 2008
@@ -26,6 +26,7 @@
import org.apache.struts2.StrutsStatics;
import org.w3c.dom.Element;
+import org.wso2.solutions.identity.IdentityProviderException;
import org.wso2.solutions.identity.cards.CardIssuer;
import org.wso2.solutions.identity.user.ui.UIConstants;
@@ -46,7 +47,7 @@
String userName = (String) session.get(UIConstants.USER);
String sessionPpid = (String) session.get(UIConstants.PPID);
- CardIssuer cardIssuer = new CardIssuer();
+ CardIssuer cardIssuer = getCardIssuer();
HttpServletResponse response = (HttpServletResponse) context
.get(StrutsStatics.HTTP_RESPONSE);
response.setContentType("application/x-informationCard");
@@ -81,5 +82,14 @@
public void setSelfIssuedPpid(String selfIssuedPpids) {
this.selfIssuedPpid = selfIssuedPpids;
}
+
+ /**
+ *
+ * @return
+ * @throws IdentityProviderException
+ */
+ protected CardIssuer getCardIssuer() throws IdentityProviderException{
+ return new CardIssuer();
+}
}
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/ShowMainAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/ShowMainAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/ShowMainAction.java
Sat Jan 5 22:17:19 2008
@@ -16,6 +16,8 @@
package org.wso2.solutions.identity.user.ui.action;
+import org.wso2.solutions.identity.IdentityConstants;
+import org.wso2.solutions.identity.UserStore;
import org.wso2.solutions.identity.admin.ClaimsAdmin;
import org.wso2.solutions.identity.admin.RegisteredInfoCardInfoAdmin;
import org.wso2.solutions.identity.admin.RelyingPartyAdmin;
@@ -23,6 +25,7 @@
import
org.wso2.solutions.identity.persistence.dataobject.UserPersonalRelyingPartyDO;
import org.wso2.solutions.identity.user.ui.UIConstants;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -57,6 +60,26 @@
this.registeredInformationCards = regCardInfoAdmin
.getAllRegisteredInfoCards(user);
+ UserStore userStore = null;
+ List propertyNames = null;
+ Map mapValues = null;
+ userStore = UserStore.getInstance();
+ propertyNames = new ArrayList();
+ propertyNames.add(IdentityConstants.CLAIM_OPENID);
+
+ // Right now we don't have a single method in UserStore, which returns
+ // the value of a single claim so we use a List.
+ mapValues = userStore.getClaimValues(user, propertyNames);
+
+ if (mapValues != null && !mapValues.isEmpty()) {
+ String openid = (String) mapValues
+ .get(IdentityConstants.CLAIM_OPENID);
+
+ if (openid != null && openid.trim().length() > 0)
+ this.addInfoMessage("Your OpenID is: " + openid);
+
+ }
+
this.loadMessages();
return SUCCESS;
Modified:
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/UserRegistrationFormSubmitAction.java
==============================================================================
---
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/UserRegistrationFormSubmitAction.java
(original)
+++
trunk/solutions/identity/modules/user-ui/src/main/java/org/wso2/solutions/identity/user/ui/action/UserRegistrationFormSubmitAction.java
Sat Jan 5 22:17:19 2008
@@ -70,6 +70,13 @@
emailAddress = request.getParameter(uri);
}
}
+
+ // We create an OpenID for all registering users, later give this
choice to the user
+ // whether to register for an OpenID at the time of normal
registration.
+ // Create an OpenID for the user
+ // TODO : remove the hard-coded port number
+ String openid = request.getServerName() + ":" +12080+
"/user/"+this.username;
+ props.put(IdentityConstants.CLAIM_OPENID, openid);
ParameterAdmin paramAdmin = new ParameterAdmin();
boolean emailVerification = paramAdmin
@@ -108,6 +115,7 @@
log.error(msg, e);
return ERROR;
}
+
store.getRealm().getUserStoreAdmin().setUserProperties(
this.username, props);
String msg = getText("successful_for", new String[]{username});
_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev