5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * The contents of this file are subject to the terms
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * of the Common Development and Distribution License
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * (the License). You may not use this file except in
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * compliance with the License.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * You can obtain a copy of the License at
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * https://opensso.dev.java.net/public/CDDLv1.0.html or
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * See the License for the specific language governing
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * permission and limitations under the License.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * When distributing Covered Code, include this CDDL
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Header Notice in each file and include the License file
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * If applicable, add the following below the CDDL Header,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * with the fields enclosed by brackets [] replaced by
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * your own identifying information:
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * "Portions Copyrighted [year] [name of copyright owner]"
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * $Id: WSFederationMetaCache.java,v 1.4 2009/10/28 23:58:59 exu Exp $
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkimport com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * The <code>WSFederationMetaCache</code> provides a metadata cache for the
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk * WS-Federation implementation.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk private static Debug debug = WSFederationMetaUtils.debug;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk private static Hashtable federationCache = new Hashtable();
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk private static Hashtable configCache = new Hashtable();
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk * Private constructor ensure that no instance is ever created
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk * Returns the standard metadata entity descriptor under the realm from
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param realm The realm under which the entity resides.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param entityId ID of the entity to be retrieved.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @return <code>FederationElement</code> for the entity or null
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * if not found.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk static FederationElement getFederation(String realm, String federationId) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String cacheKey = buildCacheKey(realm, federationId);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk (FederationElement)federationCache.get(cacheKey);
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk debug.message("WSFederationMetaCache.getEntityDescriptor: " +
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk "cacheKey = " + cacheKey + ", found = " + (federation != null));
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Adds the standard metadata entity descriptor under the realm to cache.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param realm The realm under which the entity resides.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param entityId ID of the entity to be retrieved.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param descriptor <code>FederationElement</code> for the entity.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk static void putFederation(String realm, String federationId,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String cacheKey = buildCacheKey(realm, federationId);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk debug.message("WSFederationMetaCache.putFederation: " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "WSFederationMetaCache.putFederation: delete cacheEey = " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Returns extended entity configuration under the realm from cache.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param realm The realm under which the entity resides.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param entityId ID of the entity to be retrieved.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @return <code>FederationConfigElement</code> object for the entity or
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * null if not found.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String cacheKey = buildCacheKey(realm, entityId);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk (FederationConfigElement)configCache.get(cacheKey);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk debug.message("SAML2MetaCache.getEntityConfig: cacheKey = " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Adds extended entity configuration under the realm to cache.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param realm The realm under which the entity resides.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param entityId ID of the entity to be retrieved.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param config <code>FederationConfigElement</code> object for the entity.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk static void putEntityConfig(String realm, String entityId,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String cacheKey = buildCacheKey(realm, entityId);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk debug.message("SAML2MetaCache.putEntityConfig: cacheKey = " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk "SAML2MetaCache.putEntityConfig: delete cacheKey = " +
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Clears cache completely.