Package com.sun.identity.session.util
Class RestrictedTokenContext
- java.lang.Object
-
- com.sun.identity.session.util.RestrictedTokenContext
-
public class RestrictedTokenContext extends Object
Utility to attach the context for token restriction checking to the current thread and marshalling/unmarshalling context value
-
-
Constructor Summary
Constructors Constructor Description RestrictedTokenContext()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclear()Clears the current context from this Thread Localstatic <T> TdoUsing(Object context, RestrictedTokenAction<T> action)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 restoredstatic ObjectgetCurrent()Returns the current context of the running threadstatic Stringmarshal(Object context)Serialize the current context to a stringstatic Objectunmarshal(String data)Deserialize the context from the string created by previous call to marshal()
-
-
-
Method Detail
-
getCurrent
public static Object getCurrent()
Returns the current context of the running thread- Returns:
- object containing the current context
-
doUsing
public static <T> T doUsing(Object context, RestrictedTokenAction<T> action) throws Exception
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- Parameters:
context- context to be used with the actionaction- action to be performed- Returns:
- object
- Throws:
Exception- if the there was an error.
-
marshal
public static String marshal(Object context) throws Exception
Serialize the current context to a string- Parameters:
context- to be serialized- Returns:
- string containing the serialized object
- Throws:
Exception- if the there was an error.
-
unmarshal
public static Object unmarshal(String data) throws Exception
Deserialize the context from the string created by previous call to marshal()- Parameters:
data- string containing serialized context- Returns:
- deserialized context object
- Throws:
Exception- if the there was an error.
-
clear
public static void clear()
Clears the current context from this Thread Local
-
-