com.caucho.security
Class SecurityContext

java.lang.Object
  extended by com.caucho.security.SecurityContext

public class SecurityContext
extends java.lang.Object

Defines a proxy for the current security context.


Method Summary
static void checkUserInRole(java.lang.String[] roleSet)
          Returns true if the user principal is in the specified role.
static SecurityContextProvider getProvider()
          Gets the provider for the current thread.
static java.security.Principal getUserPrincipal()
          Returns the principal for this security context.
static boolean isTransportSecure()
          Returns true if the context is secure (SSL).
static boolean isUserInRole(java.lang.String roleName)
          Returns true if the user principal is in the specified role.
static boolean isUserInRole(java.lang.String[] roleSet)
          Returns true if the user principal is in the specified role.
static java.lang.String runAs(java.lang.String role)
          Returns true if the user principal is in the specified role.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getUserPrincipal

public static java.security.Principal getUserPrincipal()
                                                throws SecurityContextException
Returns the principal for this security context.

Returns:
the principal or null of no provider for the thread.
Throws:
SecurityContextException

isUserInRole

public static boolean isUserInRole(java.lang.String roleName)
Returns true if the user principal is in the specified role.

Parameters:
roleName - the name of the role to test.

isUserInRole

public static boolean isUserInRole(java.lang.String[] roleSet)
Returns true if the user principal is in the specified role.

Parameters:
roleSet - a set of roles to test.

checkUserInRole

public static void checkUserInRole(java.lang.String[] roleSet)
Returns true if the user principal is in the specified role.

Parameters:
roleSet - a set of roles to test.

runAs

public static java.lang.String runAs(java.lang.String role)
Returns true if the user principal is in the specified role.

Parameters:
roleSet - a set of roles to test.

isTransportSecure

public static boolean isTransportSecure()
                                 throws SecurityContextException
Returns true if the context is secure (SSL).

Throws:
SecurityContextException

getProvider

public static SecurityContextProvider getProvider()
Gets the provider for the current thread.

Returns:
the provider for the thread