ssoadm.jsp revision e8721886dbfd32e88cc7077cbee4b6bb1b44b443
f743002678eb67b99bbc29fee116b65d9530fec0wrowe<%--
80833bb9a1bf25dcf19e814438a4b311d2e1f4cffuankg DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic The contents of this file are subject to the terms
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic of the Common Development and Distribution License
4da61833a1cbbca94094f9653fd970582b97a72etrawick (the License). You may not use this file except in
4da61833a1cbbca94094f9653fd970582b97a72etrawick compliance with the License.
4da61833a1cbbca94094f9653fd970582b97a72etrawick
4da61833a1cbbca94094f9653fd970582b97a72etrawick You can obtain a copy of the License at
4da61833a1cbbca94094f9653fd970582b97a72etrawick https://opensso.dev.java.net/public/CDDLv1.0.html or
4789804be088bcd86ae637a29cdb7fda25169521jailletc opensso/legal/CDDLv1.0.txt
4789804be088bcd86ae637a29cdb7fda25169521jailletc See the License for the specific language governing
4789804be088bcd86ae637a29cdb7fda25169521jailletc permission and limitations under the License.
4789804be088bcd86ae637a29cdb7fda25169521jailletc
e50c3026198fd496f183cda4c32a202925476778covener When distributing Covered Code, include this CDDL
e50c3026198fd496f183cda4c32a202925476778covener Header Notice in each file and include the License file
e50c3026198fd496f183cda4c32a202925476778covener at opensso/legal/CDDLv1.0.txt.
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrin If applicable, add the following below the CDDL Header,
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrin with the fields enclosed by brackets [] replaced by
6c3b9cebb551140fbb25d58bae08b539b3802133ylavic your own identifying information:
6c3b9cebb551140fbb25d58bae08b539b3802133ylavic "Portions Copyrighted [year] [name of copyright owner]"
6c3b9cebb551140fbb25d58bae08b539b3802133ylavic
4f29b65ab4b547ad5dbe506e2d0ff5d12ead9247ylavic $Id: ssoadm.jsp,v 1.9 2010/01/20 00:46:52 veiming Exp $
4f29b65ab4b547ad5dbe506e2d0ff5d12ead9247ylavic
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavic--%>
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavic
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavic<%--
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavic Portions Copyrighted 2010-2012 ForgeRock Inc
69301145375a889e7e37caf7cc7321ac0f91801erpluem--%>
69301145375a889e7e37caf7cc7321ac0f91801erpluem
69301145375a889e7e37caf7cc7321ac0f91801erpluem<%@ page import="com.iplanet.am.util.SystemProperties" %>
506bfe33206b2fece40ef25f695af39dd4130facjkaluza<%@ page import="com.iplanet.sso.*" %>
506bfe33206b2fece40ef25f695af39dd4130facjkaluza<%@ page import="com.sun.identity.cli.*" %>
506bfe33206b2fece40ef25f695af39dd4130facjkaluza<%@ page import="com.sun.identity.shared.Constants" %>
506bfe33206b2fece40ef25f695af39dd4130facjkaluza<%@ page import="java.text.MessageFormat" %>
d58a848a016d401b965111e50ef829e1641f7834minfrin<%@ page import="com.sun.identity.common.DNUtils" %>
d58a848a016d401b965111e50ef829e1641f7834minfrin<%@ page import="com.sun.identity.idm.AMIdentity" %>
d58a848a016d401b965111e50ef829e1641f7834minfrin<%@ page import="com.sun.identity.idm.IdType" %>
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sf<%@ page import="java.util.ResourceBundle" %>
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sf
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sf<%@ page contentType="text/html; charset=UTF-8" %>
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic<html xmlns="http://www.w3.org/1999/xhtml">
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic<head>
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic <title>OpenAM</title>
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic <link rel="stylesheet" type="text/css" href="com_sun_web_ui/css/css_ns6up.css" />
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic <link rel="shortcut icon" href="com_sun_web_ui/images/favicon/favicon.ico" type="image/x-icon" />
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic <script language="Javascript" src="js/admincli.js"></script>
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic</head>
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic<body class="DefBdy">
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic <div class="SkpMedGry1"><a href="#SkipAnchor3860"><img src="com_sun_web_ui/images/other/dot.gif" alt="Jump to End of Masthead" border="0" height="1" width="1" /></a></div><div class="MstDiv">
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic <table class="MstTblBot" title="" border="0" cellpadding="0" cellspacing="0" width="100%">
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic <tr>
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic <td class="MstTdTtl" width="99%">
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic <div class="MstDivTtl"><img name="AMConfig.configurator.ProdName" src="console/images/PrimaryProductName.png" alt="OpenAM" border="0" /></div>
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic </td>
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener <td class="MstTdLogo" width="1%"><img name="AMConfig.configurator.BrandLogo" src="com_sun_web_ui/images/other/javalogo.gif" alt="Java(TM) Logo" border="0" height="55" width="31" /></td>
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener </tr>
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener </table>
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener <table class="MstTblEnd" border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td><img name="RMRealm.mhCommon.EndorserLogo" src="com_sun_web_ui/images/masthead/masthead-sunname.gif" alt="Sun(TM) Microsystems, Inc." align="right" border="0" height="10" width="108" /></td></tr></table>
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener </div>
44ff304057225e944e220e981d434a046d14cf06covener <table class="SkpMedGry1" border="0" cellpadding="5" cellspacing="0" width="100%"><tr><td><img src="com_sun_web_ui/images/other/dot.gif" alt="Jump to End of Masthead" border="0" height="1" width="1" /></a></td></tr></table>
44ff304057225e944e220e981d434a046d14cf06covener <table border="0" cellpadding="10" cellspacing="0" width="100%"><tr><td></td></tr></table>
44ff304057225e944e220e981d434a046d14cf06covener
44ff304057225e944e220e981d434a046d14cf06covener<table cellpadding=5>
5d1ba75b8794925e67591c209085a49279791de9covener<tr>
5d1ba75b8794925e67591c209085a49279791de9covener<td>
5d1ba75b8794925e67591c209085a49279791de9covener
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand<pre>
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand<%
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand String strDisabled = SystemProperties.get("ssoadm.disabled", "true");
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand if (Boolean.parseBoolean(strDisabled)) {
caad2986f81ab263f7af41467dd622dc9add17f3ylavic response.sendRedirect(SystemProperties.get(
caad2986f81ab263f7af41467dd622dc9add17f3ylavic Constants.AM_SERVICES_DEPLOYMENT_DESCRIPTOR));
caad2986f81ab263f7af41467dd622dc9add17f3ylavic } else {
caad2986f81ab263f7af41467dd622dc9add17f3ylavic try {
45a10d38e6051fd7bdf9d742aaae633d97ff02abjailletc SSOTokenManager manager = SSOTokenManager.getInstance();
f7317ff316c2b141feea31bddb74d5d3fa1584edjorton SSOToken ssoToken = manager.createSSOToken(request);
f7317ff316c2b141feea31bddb74d5d3fa1584edjorton String adminUserDN = "";
2165214331e4afafca4048f66f303d0253d7b001covener AMIdentity adminUserId = null;
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem // This will give you the 'amAdmin' user dn
1e2d421a36999d292042a5539971070d54aa6c63ylavic String adminUser = SystemProperties.get(
1e2d421a36999d292042a5539971070d54aa6c63ylavic "com.sun.identity.authentication.super.user");
1e2d421a36999d292042a5539971070d54aa6c63ylavic if (adminUser != null) {
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh adminUserDN = DNUtils.normalizeDN(adminUser);
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh // This will give you the 'amAdmin' Identity
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh adminUserId = new AMIdentity(ssoToken, adminUser,
0b67eb8568cd58bb77082703951679b42cf098actrawick IdType.USER, "/", null);
0b67eb8568cd58bb77082703951679b42cf098actrawick }
0b67eb8568cd58bb77082703951679b42cf098actrawick
0b67eb8568cd58bb77082703951679b42cf098actrawick // This will be your incoming user/token.
5ef3c61605a3a021ff71f488983cb0065f8e1a79covener AMIdentity user = new AMIdentity(ssoToken);
fb1985a97912b25ec6564c73e610a31e5fc6e25fcovener
09c87c777bed1655621bb20e1c46cb6b1a63279dcovener if ((!adminUserDN.equals(DNUtils.normalizeDN(
6502b7b32f980cc2093bb3ebce37e5e4dc68fba4ylavic ssoToken.getPrincipal().getName()))) &&
6502b7b32f980cc2093bb3ebce37e5e4dc68fba4ylavic (!user.equals(adminUserId))) {
3060ce7f798fbda7999cd4ddf89b525d2b294185covener
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavic out.println(ResourceBundle.getBundle("encode", request.getLocale()).getString("no.permission"));
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavic return;
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavic }
e6b4bd1113567627ab6bb6c6a7105e1e01a7d889jailletc
e6b4bd1113567627ab6bb6c6a7105e1e01a7d889jailletc WebCLIHelper helper = new WebCLIHelper(request,
e466c40e1801982602ee0200c9e8b61cc148742djailletc "com.sun.identity.cli.AccessManager,com.sun.identity.federation.cli.FederationManager",
e466c40e1801982602ee0200c9e8b61cc148742djailletc "ssoadm", request.getContextPath() + "/ssoadm.jsp");
457468b82e59d01eba00dd9d0817309c8f5e414ejim out.println(helper.getHTML(request, ssoToken));
457468b82e59d01eba00dd9d0817309c8f5e414ejim Object[] param = {"0"};
457468b82e59d01eba00dd9d0817309c8f5e414ejim out.println(MessageFormat.format(
04983e3bd1754764eec7d6bb772fe3b0bf391771jorton CLIConstants.JSP_EXIT_CODE_TAG, param));
04983e3bd1754764eec7d6bb772fe3b0bf391771jorton } catch (SSOException e) {
15890c9306ba98f6fc243e15a3c4778ddc7d773erpluem response.sendRedirect("UI/Login?goto=../ssoadm.jsp");
15660979a30d251681463de2e0584853890082accovener } catch (CLIException e) {
15660979a30d251681463de2e0584853890082accovener Object[] param = {Integer.toString(e.getExitCode())};
49dacedb6c387b786b7911082ff35121a45f414bcovener out.println(MessageFormat.format(
49dacedb6c387b786b7911082ff35121a45f414bcovener CLIConstants.JSP_EXIT_CODE_TAG, param));
cfd9415521847b2f9394fad04fb701cfb955f503rjung out.println(WebCLIHelper.escapeTags(e.getMessage()));
cfd9415521847b2f9394fad04fb701cfb955f503rjung }
cfd9415521847b2f9394fad04fb701cfb955f503rjung }
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe%>
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe</pre>
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe</td></tr>
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe</table>
8491e0600f69b0405e156ea8a419653c065c645bcovener</body></html>
63b9f1f5880391261705f696d7d65507bbe9ace3covener