org.benow.security.user
Class Subject

java.lang.Object
  extended by org.benow.security.user.Subject
All Implemented Interfaces:
java.security.Principal

Deprecated.

@Deprecated
public class Subject
extends java.lang.Object
implements java.security.Principal

A Subject acts as a container for Principals. Each Principal has permissions associated with it and may have those permissions checked via checkPermission(Permission).

Subjects may be associated with ProtectedActions via the doAs(Principal,ProtectedAction) method. The protected actions may call assertPermission(Permission) to resolve and validate user permissions during execution.


Constructor Summary
Subject()
          Deprecated.  
 
Method Summary
 void addPrincipal(java.security.Principal p)
          Deprecated.  
static void assertPermission(java.lang.Class prefix, java.lang.String suffix)
          Deprecated.  
static void assertPermission(Permission perm)
          Deprecated.  
 void checkPermission(Permission perm)
          Deprecated. Checks the permissions within each of the principals contained within this subject
 void checkPermission(java.lang.String name)
          Deprecated.  
 void checkPermission(java.lang.String name, java.lang.String params)
          Deprecated.  
static User currentPrincipal()
          Deprecated. Gets the current principal for the currently executing thread.
static void doAs(User user, org.benow.java.run.MessyRunnable action)
          Deprecated. Do the given action as the given subject.
static void doAs(User user, org.benow.java.run.MessyRunnable action, boolean block)
          Deprecated. perform the given action as the given subject, infoming the given listener.
 java.lang.String getName()
          Deprecated.  
 boolean hasPermission(java.lang.Class permissionPrefix, java.lang.String suffix)
          Deprecated.  
 boolean hasPermission(Permission perm)
          Deprecated.  
 boolean hasPermission(java.lang.String name)
          Deprecated.  
 boolean hasPermission(java.lang.String name, java.lang.String params)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 

Constructor Detail

Subject

public Subject()
Deprecated. 
Method Detail

addPrincipal

public void addPrincipal(java.security.Principal p)
Deprecated. 

checkPermission

public void checkPermission(Permission perm)
                     throws java.lang.SecurityException
Deprecated. 
Checks the permissions within each of the principals contained within this subject

Parameters:
perm -
Throws:
java.lang.SecurityException

checkPermission

public void checkPermission(java.lang.String name)
                     throws java.lang.SecurityException
Deprecated. 
Throws:
java.lang.SecurityException

checkPermission

public void checkPermission(java.lang.String name,
                            java.lang.String params)
                     throws java.lang.SecurityException
Deprecated. 
Throws:
java.lang.SecurityException

hasPermission

public boolean hasPermission(java.lang.Class permissionPrefix,
                             java.lang.String suffix)
Deprecated. 

hasPermission

public boolean hasPermission(Permission perm)
Deprecated. 
Parameters:
perm -
Returns:
true if has permission

hasPermission

public boolean hasPermission(java.lang.String name)
Deprecated. 

hasPermission

public boolean hasPermission(java.lang.String name,
                             java.lang.String params)
Deprecated. 

doAs

public static void doAs(User user,
                        org.benow.java.run.MessyRunnable action)
                 throws java.lang.Throwable
Deprecated. 
Do the given action as the given subject.

Parameters:
user -
action -
Throws:
java.lang.Exception - thrown in PrivilegedAction, if any.
java.lang.Throwable

doAs

public static void doAs(User user,
                        org.benow.java.run.MessyRunnable action,
                        boolean block)
                 throws java.lang.Throwable
Deprecated. 
perform the given action as the given subject, infoming the given listener. Execution will be blocked if blocked is true (ie doAs will wait for the action to complete), or execution will occur in the background if block is false.

Parameters:
user -
action -
block - Wait for the action to complete, or process the action in a backgrounded thread?
Throws:
java.lang.Exception
java.lang.Throwable

currentPrincipal

public static User currentPrincipal()
                             throws java.lang.SecurityException
Deprecated. 
Gets the current principal for the currently executing thread. Throws SecurityException if there is no principal associated with the current thread.

Returns:
current user as assigned to current thread
Throws:
java.lang.SecurityException

assertPermission

public static void assertPermission(java.lang.Class prefix,
                                    java.lang.String suffix)
                             throws java.lang.SecurityException
Deprecated. 
Throws:
java.lang.SecurityException

assertPermission

public static void assertPermission(Permission perm)
                             throws java.lang.SecurityException
Deprecated. 
Throws:
java.lang.SecurityException

getName

public java.lang.String getName()
Deprecated. 
Specified by:
getName in interface java.security.Principal