org.apache.jetspeed.security
Class JSSubject

java.lang.Object
  extended by org.apache.jetspeed.security.JSSubject
All Implemented Interfaces:
java.io.Serializable

public class JSSubject
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
JSSubject()
           
 
Method Summary
static java.lang.Object doAs(javax.security.auth.Subject subject1, java.security.PrivilegedAction action)
          Perform work as a particular Subject after setting subject reference in current thread
static java.lang.Object doAs(javax.security.auth.Subject subject1, java.security.PrivilegedExceptionAction action)
          Perform work as a particular Subject after setting subject reference in current thread.
static java.lang.Object doAsPrivileged(javax.security.auth.Subject subject1, java.security.PrivilegedAction action, java.security.AccessControlContext acc)
          Perform privileged work as a particular Subject after setting subject reference in current thread.
static java.lang.Object doAsPrivileged(javax.security.auth.Subject subject, java.security.PrivilegedExceptionAction action, java.security.AccessControlContext acc)
          Perform privileged work as a particular Subject after setting subject reference in current thread.
static javax.security.auth.Subject getSubject(java.security.AccessControlContext acc)
          Get the Subject associated with the provided AccessControlContext fromn the current Thread or from the standard SUBJECT mechansim
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSSubject

public JSSubject()
Method Detail

getSubject

public static javax.security.auth.Subject getSubject(java.security.AccessControlContext acc)
Get the Subject associated with the provided AccessControlContext fromn the current Thread or from the standard SUBJECT mechansim

Parameters:
acc - the AccessControlContext from which to retrieve the Subject. Only used if current thread doesn't carry subject
Returns:
the Subject associated with the provided AccessControlContext, or null if no Subject is associated with the provided AccessControlContext.
Throws:
SecurityException - if the caller does not have permission to get the Subject.

java.lang.NullPointerException - if the provided AccessControlContext is null.

doAs

public static java.lang.Object doAs(javax.security.auth.Subject subject1,
                                    java.security.PrivilegedAction action)
Perform work as a particular Subject after setting subject reference in current thread

Parameters:
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.

Returns:
the Object returned by the PrivilegedAction's run method.
Throws:
java.lang.NullPointerException - if the PrivilegedAction is null.

SecurityException - if the caller does not have permission to invoke this method.

doAs

public static java.lang.Object doAs(javax.security.auth.Subject subject1,
                                    java.security.PrivilegedExceptionAction action)
                             throws java.security.PrivilegedActionException
Perform work as a particular Subject after setting subject reference in current thread.

Parameters:
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.

Returns:
the Object returned by the PrivilegedExceptionAction's run method.
Throws:
java.security.PrivilegedActionException - if the PrivilegedExceptionAction.run method throws a checked exception.

java.lang.NullPointerException - if the specified PrivilegedExceptionAction is null.

SecurityException - if the caller does not have permission to invoke this method.

doAsPrivileged

public static java.lang.Object doAsPrivileged(javax.security.auth.Subject subject1,
                                              java.security.PrivilegedAction action,
                                              java.security.AccessControlContext acc)
Perform privileged work as a particular Subject after setting subject reference in current thread.

Parameters:
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.

Returns:
the Object returned by the PrivilegedAction's run method.
Throws:
java.lang.NullPointerException - if the PrivilegedAction is null.

SecurityException - if the caller does not have permission to invoke this method.

doAsPrivileged

public static java.lang.Object doAsPrivileged(javax.security.auth.Subject subject,
                                              java.security.PrivilegedExceptionAction action,
                                              java.security.AccessControlContext acc)
                                       throws java.security.PrivilegedActionException
Perform privileged work as a particular Subject after setting subject reference in current thread.

Parameters:
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.

Returns:
the Object returned by the PrivilegedExceptionAction's run method.
Throws:
java.security.PrivilegedActionException - if the PrivilegedExceptionAction.run method throws a checked exception.

java.lang.NullPointerException - if the specified PrivilegedExceptionAction is null.

SecurityException - if the caller does not have permission to invoke this method.


Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.