Author: prabath
Date: Fri Jan 25 02:07:14 2008
New Revision: 12886

Log:

Added OpenID and OpenIDInfoCard support to the sample

Added:
   
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidsubmit.jsp
Modified:
   
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/index.html
   
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openid-infocard-submit.html
   
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidloggedin.jsp

Modified: 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/index.html
==============================================================================
--- 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/index.html
  (original)
+++ 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/index.html
  Fri Jan 25 02:07:14 2008
@@ -23,6 +23,22 @@
   </form>
 <hr/>
 
+<h2>Login with your OpenID</h2>
+
+<form name="frm" id="frm" method="post" 
action="https://localhost:12443/javarp/openidsubmit.jsp?returnUrl=https://localhost:12443/javarp/openidloggedin.jsp";>
  
+               Enter Your OpenID Url:&nbsp;&nbsp;<input type="text" size=40 
name="openIdUrl"  /><br/><br/>
+             <input type="submit" name="submit" value="Login" />   
+</form>
+
+<br/>
+
+
+<hr/>
+
+<br/>
+
+<h2><a href="openid-infocard-submit.html">Login with your OpenID 
InfoCard</a></h2>
+
 
 </body>
 </html>

Modified: 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openid-infocard-submit.html
==============================================================================
--- 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openid-infocard-submit.html
 (original)
+++ 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openid-infocard-submit.html
 Fri Jan 25 02:07:14 2008
@@ -4,13 +4,14 @@
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 </head>
 <body>
-   <form name="frm" id="frm" method="post" 
action="openidinfocardloggedin.jsp">  
+   <form name="frm" id="frm" method="post" action="openidloggedin.jsp">  
                        <input type="hidden" name="InfoCardSignin" value="Log 
in" /><br/>
-             <OBJECT type="application/x-informationCard" name="xmlToken">
+
+               <OBJECT type="application/x-informationCard" name="xmlToken">
                     <PARAM Name="tokenType" 
Value="http://specs.openid.net/auth/2.0";>
-                    <PARAM Name="requiredClaims" 
Value="http://schema.openid.net/2007/05/claims/identifier";>
-                    <param name="optionalClaims" 
Value="http://axschema.org/contact/email http://axschema.org/namePerson/first 
http://axschema.org/namePerson/last http://axschema.org/contact/phone/default 
http://axschema.org/contact/postalAddress/home 
http://axschema.org/contact/city/home 
http://axschema.org/contact/postalCode/home 
http://axschema.org/contact/country/home http://axschema.org/contact/web/blog";>
-                </OBJECT>
+                    <PARAM Name="requiredClaims" 
Value="http://schema.openid.net/2007/05/claims/identifier 
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress 
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nickname 
http://schema.openid.net/2007/05/claims/dob 
http://schema.openid.net/2007/05/claims/gender 
http://schema.openid.net/2007/05/claims/language 
http://schema.openid.net/2007/05/claims/timezone 
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country 
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode";>
+             </OBJECT>              
+
   </form>
                 <script language="JavaScript" type="text/JavaScript">
                         <!--

Modified: 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidloggedin.jsp
==============================================================================
--- 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidloggedin.jsp
  (original)
+++ 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidloggedin.jsp
  Fri Jan 25 02:07:14 2008
@@ -9,15 +9,16 @@
 <head>
 </head>
 <body>
-<%
-OpenIDConsumer consumer=OpenIDConsumer.getInstance();
-consumer.setSessionAttributes(request);
 
-%>
 
 
 <table cellpadding="0" cellspacing="0" border="0" style="width: 100%;">
        <tr>
+
+               <%
+                       String auth = 
(String)request.getAttribute(TokenVerifierConstants.SERVLET_ATTR_STATE);
+                       if(auth != null && 
TokenVerifierConstants.STATE_SUCCESS.equals(auth)) {
+               %>
        
                <table cellpadding="0" cellspacing="10" border="0"
                
@@ -82,6 +83,17 @@
                        <%}%>
                
                </table>
+
+            <%
+               } else { 
+               %>
+               <table>
+                       <tr>
+                               <td><strong>Login failed...!</strong><br />
+                               </td>
+                       </tr>
+               </table>
+               <%}%>
                </td>
        </tr>
 </table>

Added: 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidsubmit.jsp
==============================================================================
--- (empty file)
+++ 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidsubmit.jsp
    Fri Jan 25 02:07:14 2008
@@ -0,0 +1,25 @@
+<[EMAIL PROTECTED] 
import="org.wso2.solutions.identity.relyingparty.TokenVerifierConstants"%>
+<[EMAIL PROTECTED] 
import="org.wso2.solutions.identity.relyingparty.HTMLEncoder"%>
+<[EMAIL PROTECTED] import="org.wso2.solutions.identity.IdentityConstants"%>
+<[EMAIL PROTECTED] 
import="org.wso2.solutions.identity.openid.relyingparty.OpenIDAuthenticationRequest
 "%>
+<[EMAIL PROTECTED] 
import="org.wso2.solutions.identity.openid.relyingparty.OpenIDConsumer "%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
+"http://www.w3.org/TR/html4/strict.dtd";>
+<html>
+<head>
+</head>
+<body>
+
+       <%
+               OpenIDAuthenticationRequest openIDAuthRequest = null;
+       openIDAuthRequest = new OpenIDAuthenticationRequest();
+       openIDAuthRequest.setReponse(response);
+       openIDAuthRequest.setRequest(request);
+       
openIDAuthRequest.setOpenIDUrl((String)request.getParameter("openIdUrl"));
+       OpenIDConsumer.getInstance().doOpenIDAuthentication(openIDAuthRequest);
+       %>
+
+</body>
+
+</html>

_______________________________________________
Identity-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/identity-dev

Reply via email to