0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<!--
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster The contents of this file are subject to the terms
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster of the Common Development and Distribution License
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster (the License). You may not use this file except in
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster compliance with the License.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster You can obtain a copy of the License at
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster https://opensso.dev.java.net/public/CDDLv1.0.html or
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster opensso/legal/CDDLv1.0.txt
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster See the License for the specific language governing
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster permission and limitations under the License.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster When distributing Covered Code, include this CDDL
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster Header Notice in each file and include the License file
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster at opensso/legal/CDDLv1.0.txt.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster If applicable, add the following below the CDDL Header,
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster with the fields enclosed by brackets [] replaced by
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster your own identifying information:
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster "Portions Copyrighted [year] [name of copyright owner]"
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster $Id: EvaluatePolicy.jsp,v 1.2 2008/06/25 05:40:25 qcheng Exp $
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster-->
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<%@ page import="com.iplanet.sso.SSOToken"%>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<%@ page import="com.iplanet.am.util.SystemProperties"%>
41202e15f589286770cacca433bbee5df379d00bAllan Foster<%@ page import="import com.sun.identity.shared.debug.Debug"%>
41202e15f589286770cacca433bbee5df379d00bAllan Foster<! --%@ page import="com.iplanet.am.util.Debug"% -->
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<%@ page import="com.sun.identity.common.Constants"%>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<%@ page import="com.iplanet.sso.SSOTokenManager"%>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<%@ page import="com.iplanet.sso.SSOException"%>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster<html>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <head>
b93185b577f7150fec37f9999b95b246d73bf63cjeff.schenk <title>OpenAM Demo | Policy Evaluation</title>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </head>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <%
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster String serverUrl = SystemProperties.get(Constants.AM_SERVER_PROTOCOL) + "://" + SystemProperties.get(Constants.AM_SERVER_HOST)
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster + ":" + SystemProperties.get(Constants.AM_SERVER_PORT)
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster + SystemProperties.get(Constants.AM_SERVICES_DEPLOYMENT_DESCRIPTOR);
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster SSOTokenManager mgr = SSOTokenManager.getInstance();
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster SSOToken token = null;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster Debug debug = Debug.getInstance("amEvaluatePolicyServlet");
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster String requestUrl = request.getRequestURL().toString();
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster try {
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster token = mgr.createSSOToken(request);
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster } catch( SSOException e) {
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster debug.error("evaluatePolicy.jsp:: error during token creation.",e);
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster String redirectUrl = serverUrl+"/UI/Login" + "?goto=" + requestUrl;
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster response.sendRedirect(redirectUrl);
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster %>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <% } %>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <% if ((token == null) || !(mgr.isValidToken(token))) { %>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <p> <b>Sorry, you do not have a valid token to access this site.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster Please login....</b>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <% } %>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <body bgcolor="#FFFFFF" text="#000000">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <table width="600">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <tr>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <td>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <h3>Evaluate Policy</h3>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <p>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster Please enter the resource which you wish to access.
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </p>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <form action="<%=request.getContextPath()%>/evaluatePolicy"
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster method="POST">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <table bgcolor="000000" cellpadding="1" cellspacing="0">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <tr><td>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <table bgcolor="F0F0F0" border="0" cellpadding="5" cellspacing="0">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <tr>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <td>Resource to be accessed</td>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <td><input type="text" name="resource" size="80"></td>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </tr>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <tr>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <td colspan="2" align="center">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <input type="submit" name="submit" value="Evaluate">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster <input type="reset">
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </td>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </tr>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </table>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </td></tr>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </table>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </form>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </td>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </tr>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </table>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster </body>
0a99555401a033704f1f171baab6db11fb5528f2Allan Foster</html>