/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: PolicyCache.java,v 1.2 2008/06/25 05:43:07 qcheng Exp $
*
*/
/*
* Portions Copyrighted 2011 ForgeRock AS
*/
/* - NEED NOT LOG - */
/**
* This class caches policy object for Console. Token ID and a randomly
* generated string are used as key to cache and retrieve a policy.
*/
public class PolicyCache
implements SSOTokenListener
{
/**
* The generated random string is used to cache policy object when
* we switch from on tab to another. Since it is used from caching
* purposes, usage of secure random is not required.
*/
private PolicyCache() {
}
/**
* Gets an instance of policy cache
*
* @return an instance of policy cache
*/
return instance;
}
/**
* Caches a policy object
*
* @param token single sign on token
* @param policy Policy object to be cached
* @return an unique key for retrieve this policy in future
*/
try {
synchronized(mapTokenIDs) {
token.addSSOTokenListener(this);
}
randomStr = getRandomString();
}
} catch (SSOException ssoe) {
randomStr = "";
}
}
return randomStr;
}
/**
* Set a policy object with a given ID.
*
* @param token Single sign on token.
* @param cachedID ID of cached policy.
* @param policy Policy object to be cached.
*/
try {
synchronized(mapTokenIDs) {
token.addSSOTokenListener(this);
}
}
} catch (SSOException ssoe) {
}
}
}
/**
* Returns cached policy object
*
* @param token single sign on token
* @param cacheID Key for retrieve this policy
* @return policy Policy object.
* @throws AMConsoleException if policy object cannot be located.
*/
throws AMConsoleException
{
}
throw new
}
return policy;
}
/**
* Gets notification when single sign on token changes state.
*
* @param evt single sign on token event
*/
try {
switch (type) {
break;
}
} catch (SSOException ssoe) {
}
}
/**
* Clears all cached policy of a given single sign on token ID
*
* @param tokenID single sign on token ID
*/
boolean removed = false;
synchronized(mapTokenIDs) {
}
}
}
/**
* Gets a random string
*
* @return random string
*/
byte[] keyRandom = new byte[5];
}
}