Author: channa
Date: Fri May  2 00:44:46 2008
New Revision: 16474

Log:

Refactored to use generic identity instead of infocard.


Added:
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/IdentityHandler.java
      - copied, changed from r16455, 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardHandler.java
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/IdentityRegistrationBean.java
      - copied, changed from r16455, 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
   trunk/mashup/java/modules/www/identityaccept.jsp
      - copied, changed from r16455, 
trunk/mashup/java/modules/www/infocardaccept.jsp
   trunk/mashup/java/modules/www/register_self_identity.jsp
      - copied, changed from r16455, 
trunk/mashup/java/modules/www/register_self_infocard.jsp
Removed:
   
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/www/infocardaccept.jsp
   trunk/mashup/java/modules/www/register_self_infocard.jsp
Modified:
   trunk/mashup/java/modules/core/conf/web_root.xml
   trunk/mashup/java/modules/www/infocard.jsp
   trunk/mashup/java/modules/www/openidsubmit.jsp
   trunk/mashup/java/modules/www/user.jsp

Modified: trunk/mashup/java/modules/core/conf/web_root.xml
==============================================================================
--- trunk/mashup/java/modules/core/conf/web_root.xml    (original)
+++ trunk/mashup/java/modules/core/conf/web_root.xml    Fri May  2 00:44:46 2008
@@ -88,11 +88,11 @@
 
     <filter-mapping>
         <filter-name>TokenValidator</filter-name>
-        <url-pattern>/register_self_infocard.jsp</url-pattern>
+        <url-pattern>/register_self_identity.jsp</url-pattern>
     </filter-mapping>
        <filter-mapping>
         <filter-name>TokenValidator</filter-name>
-        <url-pattern>/infocardaccept.jsp</url-pattern>
+        <url-pattern>/identityaccept.jsp</url-pattern>
     </filter-mapping>
 
     <servlet>

Copied: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/IdentityHandler.java
 (from r16455, 
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/IdentityHandler.java
     Fri May  2 00:44:46 2008
@@ -47,8 +47,8 @@
 /**
  * Encapsulates the infocard based sign-in process logic.
  */
-public class InfoCardHandler {
-    private static final Log log = LogFactory.getLog(InfoCardHandler.class);
+public class IdentityHandler {
+    private static final Log log = LogFactory.getLog(IdentityHandler.class);
 
     /**
      * Retrieves the infocard parameters and uses the ppid to validate the 
user.
@@ -95,7 +95,7 @@
      *
      * @param request Servlet request object, contains attributes provided by 
the info card.
      */
-    public static boolean associateCardWithUser(HttpServletRequest request) 
throws MashupFault {
+    public static boolean associateIdentifierWithUser(HttpServletRequest 
request) throws MashupFault {
         boolean cardAdded = false;
         String identifier;
         try {
@@ -120,7 +120,7 @@
                 }
 
                 // Add only if this identifier has not been associated with a 
user.
-                if (!InfoCardHandler.isIdentifierRegistered(request, 
identifier)) {
+                if 
(!org.wso2.mashup.webapp.identity.IdentityHandler.isIdentifierRegistered(request,
 identifier)) {
                     int regCardCount = 0;
 
                     if (MashupConstants.INFOCARD.equals(authMethod)) {
@@ -251,7 +251,7 @@
             StringBuffer returnUrl = new StringBuffer();
             
returnUrl.append(request.getSession().getServletContext().getAttribute(
                     MashupConstants.WEBAPP_URL));
-            returnUrl.append("registration".equals(calledFrom) ? 
"register_self_infocard.jsp" : "infocardaccept.jsp");
+            returnUrl.append("registration".equals(calledFrom) ? 
"register_self_identity.jsp" : "identityaccept.jsp");
             returnUrl.append("?calledfrom=" + calledFrom + "&" + 
MashupConstants.AUTHENTICATION_METHOD +
                     "=openid&FromIdentityProvider=true");
             openIDAuthRequest.setReturnUrl(returnUrl.toString());

Copied: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/IdentityRegistrationBean.java
 (from r16455, 
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/IdentityRegistrationBean.java
    Fri May  2 00:44:46 2008
@@ -33,8 +33,8 @@
 /**
  * Handles the infocard based self registration process.
  */
-public class InfoCardRegistrationBean extends RegistrationBean {
-    private static final Log log = 
LogFactory.getLog(InfoCardRegistrationBean.class);
+public class IdentityRegistrationBean extends RegistrationBean {
+    private static final Log log = 
LogFactory.getLog(IdentityRegistrationBean.class);
 
     // Constants to store type of authentication, to be made enums.
     public static final String INFOCARD_TYPE = "infocard_type";

Copied: trunk/mashup/java/modules/www/identityaccept.jsp (from r16455, 
trunk/mashup/java/modules/www/infocardaccept.jsp)
==============================================================================
--- trunk/mashup/java/modules/www/infocardaccept.jsp    (original)
+++ trunk/mashup/java/modules/www/identityaccept.jsp    Fri May  2 00:44:46 2008
@@ -14,7 +14,7 @@
  * limitations under the License.
 --%>
 <%@ page errorPage="error.jsp" %>
-<%@ page import="org.wso2.mashup.webapp.identity.InfoCardHandler" %>
+<%@ page import="org.wso2.mashup.webapp.identity.IdentityHandler" %>
 <%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
 <%@ page import="org.wso2.registry.session.UserRegistry" %>
 <%@ page import="java.net.URLDecoder" %>
@@ -52,7 +52,7 @@
     // Check if the user is validated already. If so, this is to associate the 
user with the card.
     if (isLoggedIn) {
         title = "Associate Identifier with user profile";
-       if (InfoCardHandler.associateCardWithUser(request)) {
+       if 
(org.wso2.mashup.webapp.identity.IdentityHandler.associateIdentifierWithUser(request))
 {
            // Send the user back to the caling page on success - it'll show 
the added card ppid.
             response.sendRedirect(bounceback);
        } else {
@@ -61,7 +61,7 @@
     } else {
         // Unauthenticated users are trying to sign in.
          title = "Sign-in to " + bundle.getString("main.title");
-        if (InfoCardHandler.signIn(request)) {
+        if (org.wso2.mashup.webapp.identity.IdentityHandler.signIn(request)) {
                response.sendRedirect(bounceback);
             return;
         } else {

Modified: trunk/mashup/java/modules/www/infocard.jsp
==============================================================================
--- trunk/mashup/java/modules/www/infocard.jsp  (original)
+++ trunk/mashup/java/modules/www/infocard.jsp  Fri May  2 00:44:46 2008
@@ -29,7 +29,7 @@
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 </head>
 <body>
-   <form name="frm" id="frm" method="post" action="<%= 
"true".equals(fromSelfReg) ? "register_self_infocard.jsp" : 
"infocardaccept.jsp"%>">  
+   <form name="frm" id="frm" method="post" action="<%= 
"true".equals(fromSelfReg) ? "register_self_identity.jsp" : 
"identityaccept.jsp"%>">
                        <input type="hidden" name="FromIdentityProvider" 
value="true" /><br/>
             <input type="hidden" name="<%= 
MashupConstants.AUTHENTICATION_METHOD %>" value="infocard" /><br/>
             <input type="hidden" name="bounceback" value="<%=bounceback%>"/>

Modified: trunk/mashup/java/modules/www/openidsubmit.jsp
==============================================================================
--- trunk/mashup/java/modules/www/openidsubmit.jsp      (original)
+++ trunk/mashup/java/modules/www/openidsubmit.jsp      Fri May  2 00:44:46 2008
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 --%>
-<%@ page import="org.wso2.mashup.webapp.identity.InfoCardHandler" %>
+<%@ page import="org.wso2.mashup.webapp.identity.IdentityHandler" %>
 <%
-    InfoCardHandler.openIDSubmit(request, response);
+    org.wso2.mashup.webapp.identity.IdentityHandler.openIDSubmit(request, 
response);
 %>
\ No newline at end of file

Copied: trunk/mashup/java/modules/www/register_self_identity.jsp (from r16455, 
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_identity.jsp    Fri May  2 
00:44:46 2008
@@ -16,7 +16,7 @@
 <%@ 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.IdentityHandler" %>
 <%@ page import="org.wso2.mashup.webapp.identity.RegistrationBean" %>
 <%@ page import="java.net.URLDecoder" %>
 <%
@@ -32,7 +32,7 @@
         bounceback = URLDecoder.decode(bounceback, "UTF-8");
     }
 %>
-<jsp:useBean id="infoCardRegHandler" 
class="org.wso2.mashup.webapp.identity.InfoCardRegistrationBean"
+<jsp:useBean id="infoCardRegHandler" 
class="org.wso2.mashup.webapp.identity.IdentityRegistrationBean"
              scope="request">
     <jsp:setProperty name="infoCardRegHandler" property="*"/>
 </jsp:useBean>
@@ -47,7 +47,7 @@
         }
         // If the details were successfully retrieved, check for duplication.
         if (authenticatedDetailsRetrieved) {
-            identityAlreadyUsed = 
InfoCardHandler.isIdentifierRegistered(request,
+            identityAlreadyUsed = 
org.wso2.mashup.webapp.identity.IdentityHandler.isIdentifierRegistered(request,
                                                                        
infoCardRegHandler.getIdentifier());
         }
     } else {
@@ -89,7 +89,7 @@
         <% } else { %>
     <div class="mashup_title">Your infocard details have been added and will 
be verified via e-mail</div>
       <br />
-                    <form name="formRegisterSelf" method='post' 
action="register_self_infocard.jsp">
+                    <form name="formRegisterSelf" method='post' 
action="register_self_identity.jsp">
                         <input type="hidden" name="bounceback" 
value="<%=bounceback%>"/>
                         <table width="100%" border="0" cellpadding="3" 
cellspacing="0" >
                             <tr>

Modified: trunk/mashup/java/modules/www/user.jsp
==============================================================================
--- trunk/mashup/java/modules/www/user.jsp      (original)
+++ trunk/mashup/java/modules/www/user.jsp      Fri May  2 00:44:46 2008
@@ -17,7 +17,7 @@
 <%@ page import="org.wso2.mashup.MashupConstants" %>
 <%@ page import="org.wso2.mashup.utils.QueryResult" %>
 <%@ page import="org.wso2.mashup.utils.QueryResults" %>
-<%@ page import="org.wso2.mashup.webapp.identity.InfoCardHandler" %>
+<%@ page import="org.wso2.mashup.webapp.identity.IdentityHandler" %>
 <%@ page import="org.wso2.mashup.webapp.userprofile.User" %>
 <%@ page import="org.wso2.mashup.webapp.utils.QueryParamUtils" %>
 <%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
@@ -62,14 +62,16 @@
     String email = userProfile.getEmailAddress();
     String memberBio = userProfile.getBio();
     String memberFullName = memberName;
-    String[] userCards = null;
+    String[] userInfoCards = null;
+    String[] userOpenIDs = null;
 
     // If user properties are available, get the names.
     if (userProperties != null) {
         if (userProperties.containsKey(MashupConstants.FULL_NAME)) {
             memberFullName = 
userProperties.get(MashupConstants.FULL_NAME).toString();
         }
-        userCards = InfoCardHandler.getUsersCards(userProperties);
+        userInfoCards = 
org.wso2.mashup.webapp.identity.IdentityHandler.getUsersCards(userProperties);
+        userOpenIDs = 
org.wso2.mashup.webapp.identity.IdentityHandler.getUsersOpenIds(userProperties);
     }
     String customizedAuthor = 
(memberName.equals(RegistryUtils.getCurrentUser(userRegistry)) ? "My" :
             memberFullName + "'s");
@@ -270,16 +272,16 @@
                     </div>
                 </td>
             </tr>
-            <% if (userCards != null) { %>
+            <% if (userInfoCards != null) { %>
             <tr>
                 <td class="profile_label">
-                    <nobr>Registered Cards:</nobr>
+                    <nobr>Registered InfoCards:</nobr>
                 </td>
                 <td>
                     <div class="profile_username">
                     <span id="listInfocards">
                         <div class="profile_username">
-                            <% for (String cardId : userCards) { %>
+                            <% for (String cardId : userInfoCards) { %>
                             <%=cardId%><br>
                             <% } %>
                         </div>
@@ -287,6 +289,24 @@
                     </div>
                 </td>
             </tr>
+            <% }
+            if (userOpenIDs != null) { %>
+            <tr>
+                <td class="profile_label">
+                    <nobr>Registered OpenID's:</nobr>
+                </td>
+                <td>
+                    <div class="profile_username">
+                    <span id="listOpenIds">
+                        <div class="profile_username">
+                            <% for (String openID : userOpenIDs) { %>
+                            <%=openID%><br>
+                            <% } %>
+                        </div>
+                    </span>
+                    </div>
+                </td>
+            </tr>
             <% } %>
             <% if 
(RegistryUtils.getCurrentUser(userRegistry).equals(memberName)) { %>
             <tr>

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to