342N/A/**
579N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
342N/A *
342N/A * Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
342N/A *
342N/A * The contents of this file are subject to the terms
342N/A * of the Common Development and Distribution License
342N/A * (the License). You may not use this file except in
342N/A * compliance with the License.
342N/A *
342N/A * You can obtain a copy of the License at
342N/A * https://opensso.dev.java.net/public/CDDLv1.0.html or
342N/A * opensso/legal/CDDLv1.0.txt
342N/A * See the License for the specific language governing
342N/A * permission and limitations under the License.
342N/A *
342N/A * When distributing Covered Code, include this CDDL
342N/A * Header Notice in each file and include the License file
342N/A * at opensso/legal/CDDLv1.0.txt.
342N/A * If applicable, add the following below the CDDL Header,
342N/A * with the fields enclosed by brackets [] replaced by
342N/A * your own identifying information:
342N/A * "Portions Copyrighted [year] [name of copyright owner]"
342N/A *
342N/A * $Id: AddProviderToCOT.java,v 1.2 2008/06/25 05:50:01 qcheng Exp $
342N/A *
342N/A */
342N/A
342N/Apackage com.sun.identity.workflow;
342N/A
342N/Aimport com.sun.identity.cot.COTConstants;
342N/Aimport com.sun.identity.cot.COTException;
342N/Aimport com.sun.identity.cot.CircleOfTrustDescriptor;
342N/Aimport com.sun.identity.cot.CircleOfTrustManager;
342N/Aimport java.util.Collections;
342N/A
342N/A/**
342N/A * Add a provider to a circle of trust.
342N/A */
342N/Apublic class AddProviderToCOT {
342N/A private AddProviderToCOT() {
342N/A }
342N/A
342N/A public static void addToCOT(
342N/A String realm,
342N/A String cot,
342N/A String entityId
342N/A ) throws COTException {
342N/A CircleOfTrustManager cotManager = new CircleOfTrustManager();
342N/A if (!cotManager.getAllCirclesOfTrust(realm).contains(cot)) {
342N/A CircleOfTrustDescriptor desc = new CircleOfTrustDescriptor(
342N/A cot, realm, COTConstants.ACTIVE,"", null, null, null, null,
342N/A Collections.EMPTY_SET);
342N/A cotManager.createCircleOfTrust(realm, desc);
342N/A }
342N/A cotManager.addCircleOfTrustMember(realm, cot, COTConstants.SAML2,
342N/A entityId);
342N/A }
342N/A}
342N/A