public class JSSubject extends Object implements Serializable
| Constructor and Description |
|---|
JSSubject() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearSubject()
Clear subject reference in current thread.
|
static Object |
doAs(Subject subject1,
PrivilegedAction action)
Perform work as a particular
Subject after setting subject reference in current thread |
static Object |
doAs(Subject subject1,
PrivilegedExceptionAction action)
Perform work as a particular
Subject after setting subject reference in current thread. |
static Object |
doAsPrivileged(Subject subject1,
PrivilegedAction action,
AccessControlContext acc)
Perform privileged work as a particular
Subject after setting subject reference in current thread. |
static Object |
doAsPrivileged(Subject subject,
PrivilegedExceptionAction action,
AccessControlContext acc)
Perform privileged work as a particular
Subject after setting subject reference in current thread. |
static Subject |
getSubject(AccessControlContext acc)
Get the
Subject associated with the provided
AccessControlContext fromn the current Thread or from the standard SUBJECT mechansim |
public static Subject getSubject(AccessControlContext acc)
Subject associated with the provided
AccessControlContext fromn the current Thread or from the standard SUBJECT mechansim
acc - the AccessControlContext from which to retrieve
the Subject. Only used if current thread doesn't carry subjectSubject associated with the provided
AccessControlContext, or null
if no Subject is associated
with the provided AccessControlContext.SecurityException - if the caller does not have permission
to get the Subject. NullPointerException - if the provided
AccessControlContext is null.public static Object doAs(Subject subject1, PrivilegedAction action)
Subject after setting subject reference in current threadsubject - the Subject that the specified
action will run as. This parameter
may be null. action - the code to be run as the specified
Subject. Object returned by the PrivilegedAction's
run method.NullPointerException - if the PrivilegedAction
is null. SecurityException - if the caller does not have permission
to invoke this method.public static Object doAs(Subject subject1, PrivilegedExceptionAction action) throws PrivilegedActionException
Subject after setting subject reference in current thread.subject - the Subject that the specified
action will run as. This parameter
may be null. action - the code to be run as the specified
Subject. Object returned by the
PrivilegedExceptionAction's run method.PrivilegedActionException - if the
PrivilegedExceptionAction.run
method throws a checked exception. NullPointerException - if the specified
PrivilegedExceptionAction is
null. SecurityException - if the caller does not have permission
to invoke this method.public static Object doAsPrivileged(Subject subject1, PrivilegedAction action, AccessControlContext acc)
Subject after setting subject reference in current thread.subject - the Subject that the specified
action will run as. This parameter
may be null. action - the code to be run as the specified
Subject. acc - the AccessControlContext to be tied to the
specified subject and action. Object returned by the PrivilegedAction's
run method.NullPointerException - if the PrivilegedAction
is null. SecurityException - if the caller does not have permission
to invoke this method.public static Object doAsPrivileged(Subject subject, PrivilegedExceptionAction action, AccessControlContext acc) throws PrivilegedActionException
Subject after setting subject reference in current thread.subject - the Subject that the specified
action will run as. This parameter
may be null. action - the code to be run as the specified
Subject. acc - the AccessControlContext to be tied to the
specified subject and action. Object returned by the
PrivilegedExceptionAction's run method.PrivilegedActionException - if the
PrivilegedExceptionAction.run
method throws a checked exception. NullPointerException - if the specified
PrivilegedExceptionAction is
null. SecurityException - if the caller does not have permission
to invoke this method.public static void clearSubject()
Copyright © 1999–2015 The Apache Software Foundation. All rights reserved.