⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 openidpolicyrequest.jsp

📁 开源的OpenId的一个java实现
💻 JSP
字号:
<%@page import="org.wso2.solutions.identity.relyingparty.TokenVerifierConstants"%>
<%@page import="org.wso2.solutions.identity.relyingparty.HTMLEncoder"%>
<%@page import="org.wso2.solutions.identity.IdentityConstants"%>
<%@page import="org.wso2.solutions.identity.relyingparty.openid.OpenIDAuthenticationRequest"%>
<%@page import="org.wso2.solutions.identity.relyingparty.openid.OpenIDConsumer"%>
<%@page import="org.wso2.solutions.identity.relyingparty.openid.AuthPolicyType"%>
<%@page import="org.wso2.solutions.identity.relyingparty.openid.OpenIDRequestType"%>
<%@page import="org.wso2.solutions.identity.relyingparty.RelyingPartyException"%>
<%@page 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);

			String phishing= (String)request.getParameter("phishing");
			String multifactor = (String)request.getParameter("multifactor");
			String multifactorphysical= (String)request.getParameter("multifactorphysical");

                  if (phishing!= null && phishing.equalsIgnoreCase("true"))
                  {
			    openIDAuthRequest.addAuthPolicy(AuthPolicyType.PAPE_POLICY_PHISHING_RESISTANT);
		      }

                  if (multifactor!= null && multifactor.equalsIgnoreCase("true"))
                  {
			    openIDAuthRequest.addAuthPolicy(AuthPolicyType.PAPE_POLICY_MULTI_FACTOR);
		      }

                  if (multifactorphysical!= null && multifactorphysical.equalsIgnoreCase("true"))
                  {
			    openIDAuthRequest.addAuthPolicy(AuthPolicyType.PAPE_POLICY_MULTI_FACTOR_PHYSICAL);
		      }

                  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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -