Author: channa
Date: Mon Apr 28 01:01:11 2008
New Revision: 16243
Log:
Added OpenID support. WIP - for fixing dependencies.
Added:
trunk/mashup/java/modules/www/openidsubmit.jsp
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardHandler.java
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
trunk/mashup/java/modules/coreservices/sharingservice/src/org/wso2/mashup/share/service/MashupSharingService.java
trunk/mashup/java/modules/www/infocard.jsp
trunk/mashup/java/modules/www/infocardaccept.jsp
trunk/mashup/java/modules/www/register_self.jsp
trunk/mashup/java/modules/www/register_self_infocard.jsp
trunk/mashup/java/modules/www/signin.jsp
trunk/mashup/java/pom.xml
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
Mon Apr 28 01:01:11 2008
@@ -105,6 +105,10 @@
public static final String INFOCARD_PPID = "ppid";
public static final String INFOCARD_COUNT = "cardcount";
+ public static final String OPENID = "openid";
+ public static final String OPENID_COUNT = "openidcount";
+ public static final String AUTHENTICATION_METHOD = "AuthenticationMethod";
+ public static final String INFOCARD = "infocard";
// How many results to show before showing "more".
public static final int SHOW_RESULTS_COUNT = 5;
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardHandler.java
==============================================================================
---
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardHandler.java
(original)
+++
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardHandler.java
Mon Apr 28 01:01:11 2008
@@ -56,19 +56,21 @@
// If infocard has been successfully used, proceed.
String auth = (String)
request.getAttribute(TokenVerifierConstants.SERVLET_ATTR_STATE);
+ String authMethod = (String)
request.getAttribute(MashupConstants.AUTHENTICATION_METHOD);
if (TokenVerifierConstants.STATE_SUCCESS.equals(auth)) {
HttpSession session = request.getSession();
ServletContext context = session.getServletContext();
EmbeddedRegistry embeddedRegistry =
(EmbeddedRegistry)
context.getAttribute(RegistryConstants.REGISTRY);
- UserRealm realm = (UserRealm)
context.getAttribute(RegistryConstants.REGISTRY_REALM);
// Attempt to get card information and create a secure registry
instance.
try {
- String ppid = (String)
request.getAttribute(IdentityConstants.CLAIM_PPID);
- String userName = MashupUtils.login(ppid, session.getId());
+ String identifier = (String)
(MashupConstants.INFOCARD.equals(authMethod) ?
+ request.getAttribute(IdentityConstants.CLAIM_PPID) :
+
request.getAttribute(IdentityConstants.OpenId.SimpleRegAttributes.FULL_NAME));
//todo - put correct
+ String userName = MashupUtils.login(identifier,
session.getId());
UserRegistry userRegistry =
RegistryUtils.createUserRegistry(userName,
-
embeddedRegistry);
+ embeddedRegistry);
request.getSession().setAttribute(MashupConstants.USER_REGISTRY, userRegistry);
success = true;
} catch (AxisFault e) {
@@ -85,7 +87,7 @@
/**
* Associates the ppid of a given infocard with the current user.
*
- * @param request Servlet request object, contains attributes provided by
the info card.
+ * @param request Servlet request object, contains attributes provided by
the info card.
*/
public static boolean associateCardWithUser(HttpServletRequest request)
throws MashupFault {
boolean cardAdded = false;
@@ -100,21 +102,33 @@
// If infocard has been successfully used, add the card's ppid to
user's properties.
String auth = (String)
request.getAttribute(TokenVerifierConstants.SERVLET_ATTR_STATE);
+ String authMethod = (String)
request.getAttribute(MashupConstants.AUTHENTICATION_METHOD);
if (TokenVerifierConstants.STATE_SUCCESS.equals(auth)) {
- String ppid = (String)
request.getAttribute(IdentityConstants.CLAIM_PPID);
+ String identifier = (String)
request.getAttribute(IdentityConstants.CLAIM_PPID);
- // Add only if this ppid has not been associated with a user.
- if (!InfoCardHandler.isInfoCardRegistered(request, ppid)) {
+ // Add only if this identifier has not been associated with a
user.
+ if (!InfoCardHandler.isIdentifierRegistered(request,
identifier)) {
int regCardCount = 0;
- // There will be a count if keys have been registered, so
append.
- if (userProps.containsKey(MashupConstants.INFOCARD_COUNT))
{
- regCardCount = Integer.parseInt((String) userProps.get(
- MashupConstants.INFOCARD_COUNT));
+ if (MashupConstants.INFOCARD.equals(authMethod)) {
+ // There will be a count if keys have been registered,
so append.
+ if
(userProps.containsKey(MashupConstants.INFOCARD_COUNT)) {
+ regCardCount = Integer.parseInt((String)
userProps.get(
+ MashupConstants.INFOCARD_COUNT));
+ }
+ userProps.put(MashupConstants.INFOCARD_PPID +
regCardCount, identifier);
+ userProps.put(MashupConstants.INFOCARD_COUNT,
Integer.toString(regCardCount
+ + 1));
+ } else {
+ // There will be a count if keys have been registered,
so append.
+ if
(userProps.containsKey(MashupConstants.OPENID_COUNT)) {
+ regCardCount = Integer.parseInt((String)
userProps.get(
+ MashupConstants.OPENID_COUNT));
+ }
+ userProps.put(MashupConstants.OPENID + regCardCount,
identifier);
+ userProps.put(MashupConstants.OPENID_COUNT,
Integer.toString(regCardCount
+ + 1));
}
- userProps.put(MashupConstants.INFOCARD_PPID +
regCardCount, ppid);
- userProps.put(MashupConstants.INFOCARD_COUNT,
Integer.toString(regCardCount
- + 1));
userStoreAdmin.setUserProperties(currentUser, userProps);
cardAdded = true;
}
@@ -151,13 +165,35 @@
}
/**
- * Checks if a given ppid is registered for an existing user.
- * @param request Servlet request instance.
- * @param ppid PPID to be checked.
- * @return true id the ppid has already been registered.
+ * Get the list of openid's associated with this user.
+ *
+ * @param userProperties User property map containing card OpenID's
+ * @return String array with list of open ID's.
+ */
+ public static String[] getUsersOpenIds(Map userProperties) {
+ String[] openIds = null;
+ // Make sure there are associated cards.
+ if (userProperties.containsKey(MashupConstants.OPENID_COUNT)) {
+ int cardCount = Integer.parseInt((String)
userProperties.get(MashupConstants.
+ OPENID_COUNT));
+ openIds = new String[cardCount];
+ for (int id = 0; id < cardCount; id++) {
+ String openId = userProperties.get(MashupConstants.OPENID +
id).toString();
+ openIds[id] = openId;
+ }
+ }
+ return openIds;
+ }
+
+ /**
+ * Checks if a given identifier is registered for an existing user.
+ *
+ * @param request Servlet request instance.
+ * @param identifier PPID to be checked.
+ * @return true id the identifier has already been registered.
* @throws MashupFault if an error is encoutered getting user details.
*/
- public static boolean isInfoCardRegistered(HttpServletRequest request,
String ppid) throws
+ public static boolean isIdentifierRegistered(HttpServletRequest request,
String identifier) throws
MashupFault {
boolean isRegistered = false;
UserRegistry userRegistry = (UserRegistry)
request.getSession().getAttribute(
@@ -167,7 +203,7 @@
UserStoreReader storeReader = realm.getUserStoreReader();
// Null key checks across all users, so someone is registered if a
name is returned.
- String[] userNames =
storeReader.getUserNamesWithPropertyValue(null, ppid);
+ String[] userNames =
storeReader.getUserNamesWithPropertyValue(null, identifier);
if (userNames != null && userNames.length > 0) {
isRegistered = true;
}
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
==============================================================================
---
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
(original)
+++
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
Mon Apr 28 01:01:11 2008
@@ -28,63 +28,41 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.Map;
/**
* Handles the infocard based self registration process.
*/
-public class InfoCardRegistrationBean {
+public class InfoCardRegistrationBean extends RegistrationBean {
private static final Log log =
LogFactory.getLog(InfoCardRegistrationBean.class);
+ // Constants to store type of authentication, to be made enums.
+ public static final String INFOCARD_TYPE = "infocard_type";
+ public static final String OPENID_TYPE = "openid_type";
+
// Constants for storing values in the servlet context.
private final String FULL_NAME = "fullname";
private final String EMAIL_ID = "emailid";
- private final String PPID = "ppid";
+ private final String IDENTIFIER = "identifier";
+ private final String AUTHTYPE = "authtype";
// Get registration values submitted using form.
- private String userName;
- private String fullName;
- private String emailId;
- private String ppid;
- private Hashtable errors;
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getFullName() {
- return fullName;
- }
-
- public String getEmailId() {
- return emailId;
- }
-
- public String getPpid() {
- return ppid;
- }
+ private String identifier;
+ private String identifierType;
- /**
- * Initialize bean values.
- */
- public InfoCardRegistrationBean() {
- this.userName = "";
- this.errors = new Hashtable();
+ public String getIdentifier() {
+ return identifier;
}
/**
* Accepts users information submitted and initiates verification.
+ *
* @param request Servlet request object.
* @return true if self registration was successfully initiated.
*/
public boolean register(HttpServletRequest request) {
boolean success = false;
- String salutation = RegistrationBean.getSalutation(request, fullName);
+ String salutation = getSalutation(request);
// Information already validated - proceed with verification.
EmailVerifier verifier = new EmailVerifier();
@@ -92,8 +70,14 @@
Map userAttributes = new HashMap();
userAttributes.put(MashupConstants.FULL_NAME, fullName);
userAttributes.put(MashupConstants.EMAIL_ID, emailId);
- userAttributes.put(MashupConstants.INFOCARD_PPID + 0, ppid);
- userAttributes.put(MashupConstants.INFOCARD_COUNT, "1");
+
+ if (INFOCARD_TYPE.equals(identifierType)) {
+ userAttributes.put(MashupConstants.INFOCARD_PPID + 0, identifier);
+ userAttributes.put(MashupConstants.INFOCARD_COUNT, "1");
+ } else {
+ userAttributes.put(MashupConstants.OPENID + 0, identifier);
+ userAttributes.put(MashupConstants.OPENID_COUNT, "1");
+ }
// Auto generate a password becuase the user manager needs one.
String uuid = UUIDGenerator.getUUID();
@@ -110,17 +94,6 @@
}
/**
- * Return any added error messages.
- *
- * @param key Key to identify error.
- * @return Message associated with key, if it exists.
- */
- public String getErrorMessage(String key) {
- String errorMsg = (String) errors.get(key.trim());
- return (errorMsg == null) ? "" : errorMsg;
- }
-
- /**
* Validates the information in mandatory fields.
*
* @param request Servlet request object.
@@ -131,9 +104,10 @@
// Get values from context
HttpSession session = request.getSession();
- ppid = (String) session.getAttribute(PPID);
+ identifier = (String) session.getAttribute(IDENTIFIER);
fullName = (String) session.getAttribute(FULL_NAME);
emailId = (String) session.getAttribute(EMAIL_ID);
+ identifierType = (String) session.getAttribute(AUTHTYPE);
if (userName.equals("")) {
errors.put("userName", "User name cannot be empty.");
@@ -167,16 +141,44 @@
// Get the details from the infocard and add to session for
persistance.
if (TokenVerifierConstants.STATE_SUCCESS.equals(auth)) {
- ppid = (String) request.getAttribute(IdentityConstants.CLAIM_PPID);
- session.setAttribute(PPID, ppid);
+ identifier = (String)
request.getAttribute(IdentityConstants.CLAIM_PPID);
+ session.setAttribute(IDENTIFIER, identifier);
String givenName = (String)
request.getAttribute(IdentityConstants.CLAIM_GIVEN_NAME);
String surname = (String)
request.getAttribute(IdentityConstants.CLAIM_SURNAME);
fullName = givenName + " " + surname;
session.setAttribute(FULL_NAME, fullName);
emailId = (String)
request.getAttribute(IdentityConstants.CLAIM_EMAIL_ADDRESS);
session.setAttribute(EMAIL_ID, emailId);
+ session.setAttribute(AUTHTYPE, INFOCARD_TYPE);
infocardOk = true;
}
return infocardOk;
}
+
+ /**
+ * Retrieve the user's claims from the infocard, to be used in
registration.
+ *
+ * @param request Servlet request object.
+ * @return True if infocard information has been retrieved successfully.
+ */
+ public boolean setOpenIdDetails(HttpServletRequest request) {
+ boolean openIdOk = false;
+ HttpSession session = request.getSession();
+
+ // If infocard has been successfully used, proceed.
+ String auth = (String)
request.getAttribute(TokenVerifierConstants.SERVLET_ATTR_STATE);
+
+ // Get the details from the infocard and add to session for
persistance.
+ if (TokenVerifierConstants.STATE_SUCCESS.equals(auth)) {
+ identifier = (String)
request.getAttribute(IdentityConstants.OpenId.SimpleRegAttributes.FULL_NAME);
// todo
+ session.setAttribute(IDENTIFIER, identifier);
+ fullName = (String)
request.getAttribute(IdentityConstants.OpenId.SimpleRegAttributes.FULL_NAME);
+ session.setAttribute(FULL_NAME, fullName);
+ emailId = (String)
request.getAttribute(IdentityConstants.OpenId.SimpleRegAttributes.EMAIL);
+ session.setAttribute(EMAIL_ID, emailId);
+ session.setAttribute(AUTHTYPE, OPENID_TYPE);
+ openIdOk = true;
+ }
+ return openIdOk;
+ }
}
Modified:
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
==============================================================================
---
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
(original)
+++
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
Mon Apr 28 01:01:11 2008
@@ -46,15 +46,15 @@
private static final Log log = LogFactory.getLog(RegistrationBean.class);
// Get registration values submitted using form.
- private String userName;
- private String fullName;
+ protected String userName;
+ protected String fullName;
private String password;
private String confirmedPassword;
- private String emailId;
+ protected String emailId;
private String captcha;
private boolean adminCreation;
- private Hashtable errors;
+ protected Hashtable errors;
public String getUserName() {
return userName;
@@ -132,7 +132,7 @@
*/
public boolean register(HttpServletRequest request) {
boolean success = false;
- String salutation = getSalutation(request, fullName);
+ String salutation = getSalutation(request);
// Information already validated - proceed with verification.
EmailVerifier verifier = new EmailVerifier();
@@ -399,10 +399,9 @@
/**
* Returns a salutation given a full name string.
- * @param fullName The full name of the person being addressed.
* @return A salutation string.
*/
- public static String getSalutation(HttpServletRequest request, String
fullName) {
+ protected String getSalutation(HttpServletRequest request) {
String greeting = (String)
request.getSession().getServletContext().getAttribute(
MashupConstants.EMAIL_GREETING);
StringBuffer salutation = new StringBuffer(greeting);
Modified:
trunk/mashup/java/modules/coreservices/sharingservice/src/org/wso2/mashup/share/service/MashupSharingService.java
==============================================================================
---
trunk/mashup/java/modules/coreservices/sharingservice/src/org/wso2/mashup/share/service/MashupSharingService.java
(original)
+++
trunk/mashup/java/modules/coreservices/sharingservice/src/org/wso2/mashup/share/service/MashupSharingService.java
Mon Apr 28 01:01:11 2008
@@ -30,7 +30,7 @@
import org.wso2.registry.users.UserStoreReader;
import org.wso2.solutions.identity.IdentityConstants;
import org.wso2.solutions.identity.relyingparty.RelyingPartyException;
-import org.wso2.solutions.identity.relyingparty.TokenVerifier;
+import org.wso2.solutions.identity.relyingparty.
import org.wso2.utils.ServerConfiguration;
import javax.activation.DataHandler;
@@ -144,7 +144,7 @@
.toCharArray());
//Decrypting the InfoCard token
- TokenVerifier verifier = new TokenVerifier();
+ SAMLTokenVerifier verifier = new SAMLTokenVerifier();
Element decryptedToken = verifier.decryptToken(infoCardToken,
privateKey);
if (verifier.verifyDecryptedToken(decryptedToken)) {
Modified: trunk/mashup/java/modules/www/infocard.jsp
==============================================================================
--- trunk/mashup/java/modules/www/infocard.jsp (original)
+++ trunk/mashup/java/modules/www/infocard.jsp Mon Apr 28 01:01:11 2008
@@ -14,6 +14,7 @@
~ limitations under the License.
-->
<%@ page errorPage="error.jsp" %>
+<%@ page import="org.wso2.mashup.MashupConstants" %>
<%@ page import="java.net.URLDecoder" %>
<%
String bounceback = request.getParameter("bounceback");
@@ -30,6 +31,7 @@
<body>
<form name="frm" id="frm" method="post" action="<%=
"true".equals(fromSelfReg) ? "register_self_infocard.jsp" :
"infocardaccept.jsp"%>">
<input type="hidden" name="InfoCardSignin" value="Log
in" /><br/>
+ <input type="hidden" name="<%=
MashupConstants.AUTHENTICATION_METHOD %>" value="infocard" /><br/>
<input type="hidden" name="bounceback" value="<%=bounceback%>"/>
<OBJECT type="application/x-informationCard" name="xmlToken">
<PARAM Name="tokenType"
Value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1">
Modified: trunk/mashup/java/modules/www/infocardaccept.jsp
==============================================================================
--- trunk/mashup/java/modules/www/infocardaccept.jsp (original)
+++ trunk/mashup/java/modules/www/infocardaccept.jsp Mon Apr 28 01:01:11 2008
@@ -31,7 +31,7 @@
%>
<html>
<head>
- <title><%= bundle.getString("main.title")%> - Accept Infocard</title>
+ <title><%= bundle.getString("main.title")%> - Accept Identifier</title>
<!-- Required CSS -->
<link href="css/styles.css" rel="stylesheet" type="text/css"/>
<script language="javascript" src="js/common.js"
type="text/javascript"></script>
@@ -51,12 +51,12 @@
// Check if the user is validated already. If so, this is to associate the
user with the card.
if (isLoggedIn) {
- title = "Associate InfoCard with user profile";
+ title = "Associate Identifier with user profile";
if (InfoCardHandler.associateCardWithUser(request)) {
// Send the user back to the caling page on success - it'll show
the added card ppid.
response.sendRedirect(bounceback);
} else {
- message = "Could not add InfoCard to user profile.";
+ message = "Could not add Identifier to user profile.";
}
} else {
// Unauthenticated users are trying to sign in.
@@ -65,8 +65,8 @@
response.sendRedirect(bounceback);
return;
} else {
- message = "InfoCard based login failed." +
- "<br/><strong>If your browser supports CardSpace
authentication, please make sure you have registered your InfoCard</strong>.";
+ message = "Identifier based login failed." +
+ "<br/><strong>If your browser supports CardSpace
authentication, please make sure you have registered your Identifier</strong>.";
}
}
%>
Added: trunk/mashup/java/modules/www/openidsubmit.jsp
==============================================================================
--- (empty file)
+++ trunk/mashup/java/modules/www/openidsubmit.jsp Mon Apr 28 01:01:11 2008
@@ -0,0 +1,77 @@
+<[EMAIL PROTECTED] import="com.sun.syndication.feed.synd.*"%>
+<[EMAIL PROTECTED] import="com.sun.syndication.io.SyndFeedOutput"%>
+<[EMAIL PROTECTED] import="org.apache.axis2.context.ConfigurationContext"%>
+<[EMAIL PROTECTED] import="org.wso2.mashup.MashupConstants"%>
+<[EMAIL PROTECTED] import="org.wso2.mashup.MashupFault"%>
+<%@ page import="org.wso2.mashup.utils.MashupUtils" %>
+<%@ page import="org.wso2.mashup.utils.QueryResult" %>
+<%@ page import="org.wso2.mashup.utils.QueryResults" %>
+<%@ page import="org.wso2.mashup.webapp.MashupUiFault" %>
+<%@ page import="org.wso2.mashup.webapp.identity.InfoCardHandler" %>
+<%@ page import="org.wso2.mashup.webapp.identity.RegistrationBean" %>
+<%@ page import="org.wso2.mashup.webapp.userprofile.ManageUsers" %>
+<%@ page import="org.wso2.mashup.webapp.userprofile.User" %>
+<%@ page import="org.wso2.mashup.webapp.userprofile.UserInformation" %>
+<%@ page import="org.wso2.mashup.webapp.userprofile.UserQuery" %>
+<%@ page import="org.wso2.mashup.webapp.utils.QueryParamUtils" %>
+<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
+<%@ page import="org.wso2.registry.*" %>
+<%@ page import="org.wso2.registry.jdbc.EmbeddedRegistry" %>
+<%@ page import="org.wso2.registry.session.UserRegistry" %>
+<%@ page import="org.wso2.registry.users.UserRealm" %>
+<%@ page import="org.wso2.registry.users.UserStoreAdmin" %>
+<%@ page import="org.wso2.registry.users.UserStoreException" %>
+<%@ page import="org.wso2.solutions.identity.IdentityConstants" %>
+<%@ page
import="org.wso2.solutions.identity.relyingparty.RelyingPartyException" %>
+<%@ page import="org.wso2.utils.ServerConfiguration" %>
+<%@ page import="org.wso2.wsas.ServerManager" %>
+<%@ page import="java.io.BufferedReader" %>
+<%@ page import="java.io.FileReader" %>
+<%@ page import="java.net.URL" %>
+<%@ page import="java.net.URLDecoder" %>
+<%@ page import="java.net.URLEncoder" %>
+<%@ page import="java.util.*" %>
+
+<%
+ String calledFrom = request.getParameter("calledfrom");
+try
+{
+ OpenIDAuthenticationRequest openIDAuthRequest = null;
+
+ openIDAuthRequest = new OpenIDAuthenticationRequest(request,response);
+
+ openIDAuthRequest.setOpenIDUrl((String)request.getParameter("openIdUrl"));
+
+ // you need to set an absolute url as the return url.
+ // once the user authenticated successfully or failed at the OpenID
+ // Provider, the browser will be redirected to this url
+ String pageName = "registration".equals(calledFrom) ?
"register_self_infocard.jsp" : "infocardaccept.jsp";
+ openIDAuthRequest.setReturnUrl(pageName + "?calledfrom=" + calledFrom + "&"
+
+ MashupConstants.AUTHENTICATION_METHOD + "=openid");
+
+ // Use Simple Attribute Registration 1.1
+ openIDAuthRequest.addRequestType(OpenIDRequestType.SIMPLE_REGISTRATION);
+
+ // 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);
+
+ // Performs authentication : this will redirect you to OpenID Provider for
authentication
+ OpenIDConsumer.getInstance().doOpenIDAuthentication(openIDAuthRequest);
+
+}
+catch(RelyingPartyException e)
+{
+ // handle exceptions
+ out.println(e.getMessage());
+}
+
+%>
\ No newline at end of file
Modified: trunk/mashup/java/modules/www/register_self.jsp
==============================================================================
--- trunk/mashup/java/modules/www/register_self.jsp (original)
+++ trunk/mashup/java/modules/www/register_self.jsp Mon Apr 28 01:01:11 2008
@@ -212,7 +212,11 @@
</table>
<strong><font color="#FF0000">*</font></strong>
Required fields
</form>
-
+ <form name="openidsignin" id="openidsignin" method="post"
action="openidsubmit.jsp">
+ Enter Your OpenID Url for self registration:<input type="text"
name="openIdUrl"/>
+ <input type="hidden" name="calledfrom" value="registration"/>
+ <input type="submit" name="submit" value="Login" />
+ </form>
<br>
<% } else { %>
<div class="mashup_title">Self Registration Disabled</div>
Modified: trunk/mashup/java/modules/www/register_self_infocard.jsp
==============================================================================
--- trunk/mashup/java/modules/www/register_self_infocard.jsp (original)
+++ trunk/mashup/java/modules/www/register_self_infocard.jsp Mon Apr 28
01:01:11 2008
@@ -15,19 +15,16 @@
--%>
<%@ page errorPage="error.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page import="org.wso2.mashup.MashupConstants" %>
<%@ page import="org.wso2.mashup.webapp.identity.InfoCardHandler" %>
<%@ page import="org.wso2.mashup.webapp.identity.RegistrationBean" %>
-<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
-<%@ page import="org.wso2.registry.session.UserRegistry" %>
<%@ page import="java.net.URLDecoder" %>
-<%@ page import="java.net.URLEncoder" %>
-<%@ page import="java.util.ResourceBundle" %>
<%
ResourceBundle bundle = ResourceBundle.getBundle("UI");
UserRegistry userRegistry = RegistryUtils.getRegistry(request);
String bounceback = request.getParameter("bounceback");
- String infoCardPresented = request.getParameter("InfoCardSignin");
+ String infoCardPresented =
request.getParameter(MashupConstants.AUTHENTICATION_METHOD);
if (bounceback == null) {
bounceback = "index.jsp";
} else {
@@ -39,15 +36,15 @@
<jsp:setProperty name="infoCardRegHandler" property="*"/>
</jsp:useBean>
<%
- boolean infocardDetailsRetrieved = false;
- boolean infocardAlreadyUsed = false;
+ boolean authenticatedDetailsRetrieved = false;
+ boolean identityAlreadyUsed = false;
if ("Log in".equals(infoCardPresented)) {
- infocardDetailsRetrieved =
infoCardRegHandler.setInfoCardDetails(request);
+ authenticatedDetailsRetrieved =
infoCardRegHandler.setInfoCardDetails(request);
// If the details were successfully retrieved, check for duplication.
- if (infocardDetailsRetrieved) {
- infocardAlreadyUsed = InfoCardHandler.isInfoCardRegistered(request,
-
infoCardRegHandler.getPpid());
+ if (authenticatedDetailsRetrieved) {
+ identityAlreadyUsed =
InfoCardHandler.isIdentifierRegistered(request,
+
infoCardRegHandler.getIdentifier());
}
} else {
if (infoCardRegHandler.isInputValid(request)) {
@@ -78,9 +75,9 @@
<div id="search"></div>
<div id="content" style="height:400px; ">
<% if (RegistrationBean.isSelfRegistrationEnabled()) {
- if ("Log in".equals(infoCardPresented) &&
(!infocardDetailsRetrieved || infocardAlreadyUsed)) { %>
+ if ("Log in".equals(infoCardPresented) &&
(!authenticatedDetailsRetrieved || identityAlreadyUsed)) { %>
<div class="mashup_title">Infocard Error</div>
- <div> <%= infocardAlreadyUsed ?
bundle.getString("register.self.infocardreused") :
+ <div> <%= identityAlreadyUsed ?
bundle.getString("register.self.infocardreused") :
bundle.getString("register.self.infocarderror") %>
<a
href="register_self.jsp?firstcall=true&bounceback=<%=URLEncoder.encode(thisPage,"UTF-8")%>">here</a>.
</div>
Modified: trunk/mashup/java/modules/www/signin.jsp
==============================================================================
--- trunk/mashup/java/modules/www/signin.jsp (original)
+++ trunk/mashup/java/modules/www/signin.jsp Mon Apr 28 01:01:11 2008
@@ -272,7 +272,11 @@
<br/>
<br/>
</form>
-
+ <form name="openidsignin" id="openidsignin" method="post"
action="openidsubmit.jsp">
+ Enter Your OpenID Url:<input type="text" name="openIdUrl"/>
+ <input type="hidden" name="calledfrom" value="signin"/>
+ <input type="submit" name="submit" value="Login" />
+ </form>
</td>
</tr>
Modified: trunk/mashup/java/pom.xml
==============================================================================
--- trunk/mashup/java/pom.xml (original)
+++ trunk/mashup/java/pom.xml Mon Apr 28 01:01:11 2008
@@ -1165,6 +1165,56 @@
<artifactId>commons-pool</artifactId>
<version>${commons.pool.version}</version>
</dependency>
+ <dependency>
+ <groupId>opensaml</groupId>
+ <artifactId>opensaml</artifactId>
+ <version>${opensaml.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openid4java</groupId>
+ <artifactId>openid4java-nodeps</artifactId>
+ <version>${openid.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.ibm.icu</groupId>
+ <artifactId>icu4j</artifactId>
+ <version>3.4.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openxri</groupId>
+ <artifactId>openxri-syntax</artifactId>
+ <version>1.0.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openxri</groupId>
+ <artifactId>openxri-client</artifactId>
+ <version>1.0.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-security</groupId>
+ <artifactId>xmlsec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.htmlparser</groupId>
+ <artifactId>htmlparser</artifactId>
+ <version>1.6</version>
+ </dependency>
</dependencies>
<modules>
@@ -1252,7 +1302,7 @@
<wso2-monitor.version>SNAPSHOT</wso2-monitor.version>
<wso2registry.core.version>SNAPSHOT</wso2registry.core.version>
<usermanager.version>SNAPSHOT</usermanager.version>
- <identity.version>1.0</identity.version>
+ <identity.version>1.5</identity.version>
<derby.version>10.1.1.0</derby.version>
<registry.driverClass>org.apache.derby.jdbc.EmbeddedDriver</registry.driverClass>
@@ -1264,5 +1314,9 @@
<usermanager.password>wso2mashupServer</usermanager.password>
<commons.dbcp.version>1.2.2</commons.dbcp.version>
<commons.pool.version>1.3</commons.pool.version>
+
+ <opensaml.version>1.1.406</opensaml.version>
+ <openid.version>0.9.3.1</openid.version>
+
</properties>
</project>
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev