Author: prabath
Date: Tue Mar  4 22:32:41 2008
New Revision: 14511

Log:

PAPE demo

Added:
   
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidpolicyrequest.jsp

Added: 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidpolicyrequest.jsp
==============================================================================
--- (empty file)
+++ 
trunk/solutions/identity/modules/samples/servlet-filter/src/main/webapp/openidpolicyrequest.jsp
     Tue Mar  4 22:32:41 2008
@@ -0,0 +1,83 @@
+<[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.relyingparty.openid.OpenIDAuthenticationRequest"%>
+<[EMAIL PROTECTED] 
import="org.wso2.solutions.identity.relyingparty.openid.OpenIDConsumer"%>
+<[EMAIL PROTECTED] 
import="org.wso2.solutions.identity.relyingparty.openid.AuthPolicyType"%>
+<[EMAIL PROTECTED] 
import="org.wso2.solutions.identity.relyingparty.openid.OpenIDRequestType"%>
+<[EMAIL PROTECTED] 
import="org.wso2.solutions.identity.relyingparty.RelyingPartyException"%>
+<[EMAIL PROTECTED] import="org.wso2.utils.ServerConfiguration"%>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
+"http://www.w3.org/TR/html4/strict.dtd";>
+<html>
+<head>
+</head>
+<body>
+
+       <%
+               try
+               {
+                       OpenIDAuthenticationRequest openIDAuthRequest = null;
+               openIDAuthRequest = new 
OpenIDAuthenticationRequest(request,response);
+       
+               
openIDAuthRequest.setOpenIDUrl((String)request.getParameter("openIdUrl"));
+
+                       ServerConfiguration serverConfig = null;
+               String host = null;
+               String httpsPort = null;
+
+               serverConfig = ServerConfiguration.getInstance();
+               host = serverConfig.getFirstProperty("HostName");
+               httpsPort = serverConfig.getFirstProperty("Ports.HTTPS");     
+
+                  openIDAuthRequest.addRequestType(OpenIDRequestType.PAPE);
+
+                       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);
+
+                  
openIDAuthRequest.addAuthPolicy(AuthPolicyType.PAPE_POLICY_PHISHING_RESISTANT);
+
+                  openIDAuthRequest.setMaxAuthAge(10);
+                         
+               openIDAuthRequest.setReturnUrl("https://"; + host + ":" + 
httpsPort + "/" + "javarp/openidloggedin.jsp");
+
+               
OpenIDConsumer.getInstance().doOpenIDAuthentication(openIDAuthRequest);
+               }
+               catch(RelyingPartyException e)
+               {
+                       out.println(e.getMessage());
+               }
+
+
+       %>
+
+<br/><br/>
+
+<a href="index.html">Back</a>
+
+</body>
+
+</html>
+

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

Reply via email to