|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.security.auth.Subject
public final class Subject
| Constructor Summary | |
|---|---|
Subject()
|
|
Subject(boolean readOnly,
Set principals,
Set pubCred,
Set privCred)
|
|
| Method Summary | |
|---|---|
static Object |
doAs(Subject subject,
PrivilegedAction action)
Run a method as another subject. |
static Object |
doAs(Subject subject,
PrivilegedExceptionAction action)
Run a method as another subject. |
static Object |
doAsPrivileged(Subject subject,
PrivilegedAction action,
AccessControlContext acc)
Run a method as another subject. |
static Object |
doAsPrivileged(Subject subject,
PrivilegedExceptionAction action,
AccessControlContext acc)
Run a method as another subject. |
boolean |
equals(Object o)
equals compares this object to another object. |
Set |
getPrincipals()
|
Set |
getPrincipals(Class clazz)
|
Set |
getPrivateCredentials()
|
Set |
getPrivateCredentials(Class clazz)
|
Set |
getPublicCredentials()
|
Set |
getPublicCredentials(Class clazz)
|
static Subject |
getSubject(AccessControlContext context)
Returns the subject associated with the given AccessControlContext. |
int |
hashCode()
hashCode returns a hash code for this object. |
boolean |
isReadOnly()
Returns whether or not this subject is read-only. |
void |
setReadOnly()
Marks this subject as read-only. |
String |
toString()
toString creates a printable string that represents this object for debugging purposes. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Subject()
public Subject(boolean readOnly,
Set principals,
Set pubCred,
Set privCred)
| Method Detail |
|---|
public static Subject getSubject(AccessControlContext context)
Returns the subject associated with the given AccessControlContext.
All this method does is retrieve the Subject object from the supplied
context's DomainCombiner, if any, and if it is an instance of
a SubjectDomainCombiner.
context - The context to retrieve the subject from.
null
if there is none.
NullPointerException - If subject is null.
SecurityException - If the caller does not have permission to get
the subject ("getSubject" target of AuthPermission.
public static Object doAs(Subject subject,
PrivilegedAction action)
Run a method as another subject. This method will obtain the current
AccessControlContext for this thread, then creates another with
a SubjectDomainCombiner with the given subject. The supplied
action will then be run with the modified context.
subject - The subject to run as.action - The action to run.
SecurityException - If the caller is not allowed to run under a
different identity ("doAs" target of AuthPermission.
public static Object doAs(Subject subject,
PrivilegedExceptionAction action)
throws PrivilegedActionException
Run a method as another subject. This method will obtain the current
AccessControlContext for this thread, then creates another with
a SubjectDomainCombiner with the given subject. The supplied
action will then be run with the modified context.
subject - The subject to run as.action - The action to run.
SecurityException - If the caller is not allowed to run under a
different identity ("doAs" target of AuthPermission.
PrivilegedActionException - If the action throws an exception.
public static Object doAsPrivileged(Subject subject,
PrivilegedAction action,
AccessControlContext acc)
Run a method as another subject. This method will create a new
AccessControlContext derived from the given one, with a
SubjectDomainCombiner with the given subject. The supplied
action will then be run with the modified context.
subject - The subject to run as.action - The action to run.acc - The context to use.
SecurityException - If the caller is not allowed to run under a
different identity ("doAsPrivileged" target of AuthPermission.
public static Object doAsPrivileged(Subject subject,
PrivilegedExceptionAction action,
AccessControlContext acc)
throws PrivilegedActionException
Run a method as another subject. This method will create a new
AccessControlContext derived from the given one, with a
SubjectDomainCombiner with the given subject. The supplied
action will then be run with the modified context.
subject - The subject to run as.action - The action to run.acc - The context to use.
SecurityException - If the caller is not allowed to run under a
different identity ("doAsPrivileged" target of
AuthPermission.
PrivilegedActionException - If the action throws an exception.public boolean equals(Object o)
ObjectEquals must be symmetric (a.equals(b) == b.equals(a)), reflexive (a.equals(a)==true) and transitive (a.equals(b) && b.equals(c) IMPLIES (a.equals(c))) and not change over time (a.equals(b) == a.equals(b)). a.equals(null) should always return false.
If a.equals(b) is true for two objects a and b, then a.hashCode()==b.hashCode() must hold.
The default implementation of equals returns this==other.
equals in class Objecto - the other object.
public Set getPrincipals()
public Set getPrincipals(Class clazz)
public Set getPrivateCredentials()
public Set getPrivateCredentials(Class clazz)
public Set getPublicCredentials()
public Set getPublicCredentials(Class clazz)
public int hashCode()
ObjectThe default implementation returns System.identityHashCode(this).
hashCode in class Objectpublic boolean isReadOnly()
Returns whether or not this subject is read-only.
public void setReadOnly()
Marks this subject as read-only.
SecurityException - If the caller does not have permission to
set this subject as read-only ("setReadOnly" target of
AuthPermission.public String toString()
ObjectThe default implementation returns getClass().getName() + '@' + Integer.toHexString(hashCode()).
toString in class Object
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||