RestrictedTokenContext.java revision 96a86856ac0b95878e74e5ed8d417572493324ce
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 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: RestrictedTokenContext.java,v 1.4 2008/06/25 05:43:59 qcheng Exp $
*
* Portions copyright 2010-2015 ForgeRock AS.
*/
/**
* Utility to attach the context for token restriction checking to the current
* thread and marshalling/unmarshalling context value
*/
public class RestrictedTokenContext {
/* The LocalThread for the currentcontext*/
/* The Object prefix*/
/*The Token Prefix*/
/**
* Returns the current context of the running thread
*
* @return object containing the current context
*/
public static Object getCurrent() {
return currentContext.get();
}
/**
* Performs an action while temporary replacing the current token
* restriction checking context associated with the running thread After
* returning from action run() method original context is restored
*
* @param context
* context to be used with the action
* @param action
* action to be performed
* @return object
* @throws Exception if the there was an error.
*/
throws Exception {
try {
} finally {
}
}
/**
* Serialize the current context to a string
*
* @param context
* to be serialized
* @return string containing the serialized object
* @throws Exception if the there was an error.
*/
} else {
// perform general Java serialization
}
}
/**
* Deserialize the context from the string created by previous call to
* marshal()
*
* @param data
* string containing serialized context
* @return deserialized context object
* @throws Exception if the there was an error.
*/
// perform general Java deserialization
return is.readObject();
} else {
}
}
/**
* Clears the current context from this Thread Local
*
*/
public static void clear() {
}
}