4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster The contents of this file are subject to the terms
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster of the Common Development and Distribution License
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster (the License). You may not use this file except in
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster compliance with the License.
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster You can obtain a copy of the License at
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster https://opensso.dev.java.net/public/CDDLv1.0.html or
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster See the License for the specific language governing
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster permission and limitations under the License.
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster When distributing Covered Code, include this CDDL
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster Header Notice in each file and include the License file
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster If applicable, add the following below the CDDL Header,
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster with the fields enclosed by brackets [] replaced by
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster your own identifying information:
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster "Portions Copyrighted [year] [name of copyright owner]"
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster $Id: header.jsp,v 1.5 2008/06/25 05:49:26 qcheng Exp $
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster<%@ page language="java"
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster com.sun.identity.plugin.session.SessionException,
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster com.sun.identity.plugin.session.SessionProvider,
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster com.sun.identity.plugin.session.SessionManager,
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster com.sun.identity.shared.configuration.SystemPropertiesManager,
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster boolean loggedIn = false;
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String redirectUrl = null;
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String localAuthUrl = null;
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String baseURL = request.getRequestURI().toString();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster int idx = baseURL.indexOf('/', 1);
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String baseURI = baseURL.substring(idx);
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String localProto = request.getScheme();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String localHost = request.getServerName();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String localPort = "" + request.getServerPort();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String localDeploymentURI = baseURL.substring(0, idx);
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster baseURL = localProto + "://" + localHost +
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster ":" + localPort + localDeploymentURI;
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String baseHost = request.getServerName();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String realBaseURL =
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster SystemPropertiesManager.get(Constants.AM_SERVER_PROTOCOL) + "://" +
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster SystemPropertiesManager.get(Constants.AM_SERVER_HOST) + ":" +
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster SystemPropertiesManager.get(Constants.AM_SERVER_PORT) +
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster SystemPropertiesManager.get(Constants.AM_SERVICES_DEPLOYMENT_DESCRIPTOR);
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster SessionProvider provider = SessionManager.getProvider();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster Object sess = provider.getSession(request);
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster if (sess != null) {
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster loggedIn = provider.isValid(sess);
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster } catch (SessionException e) {
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String defaultOrg = "/";
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster public void createCircleOfTrust(String cotName,String hostedEntityID,
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster String remoteEntityID) throws COTException {
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster // [START] Create Circle of Trust
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster CircleOfTrustManager cotManager = new CircleOfTrustManager();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster Set cots = cotManager.getAllCirclesOfTrust("/");
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster boolean cotExists = ((cots != null && !cots.isEmpty())
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster if (cotExists) {
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster Set memberList =
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster cotManager.listCircleOfTrustMember("/",cotName,
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster if ((memberList != null && !memberList.isEmpty())
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster && !memberList.contains(hostedEntityID)) {
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster hostedEntityID);
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster if ((memberList != null && !memberList.isEmpty())
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster && !memberList.contains(remoteEntityID)) {
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster remoteEntityID);
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster Set<String> providers = new HashSet<String>();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster providers.add(hostedEntityID + COTConstants.DELIMITER +
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster providers.add(remoteEntityID + COTConstants.DELIMITER +
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster cotManager = new CircleOfTrustManager();
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster new CircleOfTrustDescriptor(cotName, "/",
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster COTConstants.ACTIVE, "", null, null,
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster null, null, providers));
4fe4e4f798a84a46e567f64ceadd3648eb0582d4Allan Foster // [END] Create Circle of Trust