BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.security.service
Class SecurityManager

java.lang.Object
  |
  +--weblogic.security.service.SecurityManager

public class SecurityManager
extends java.lang.Object

Author:
Copyright © 2002 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
SecurityManager()
           
 
Method Summary
static void checkKernelIdentity(weblogic.security.acl.internal.AuthenticatedSubject s)
          Throws an exception if the Subject passed in is not kernel identity.
static void checkKernelPermission()
          If we are using Java 2 security and on the server, check to see if we currently have RuntimePermission("weblogic.kernelPermission").
static weblogic.security.acl.internal.AuthenticatedSubject getCurrentSubject(weblogic.security.acl.internal.AuthenticatedSubject kernelId)
          Return the current threads client identity, return an empty Subject instance if the current subject is null.
static weblogic.security.acl.internal.AuthenticatedSubject getDefaultUser()
           
static boolean isKernelIdentity(weblogic.security.acl.internal.AuthenticatedSubject s)
          Returns true if the Subject passed in is the kernel identity.
static void popSubject(weblogic.security.acl.internal.AuthenticatedSubject kernelIdentity)
          On the behalf of the initiator pop the subject identity off the thread stack.
static void pushSubject(weblogic.security.acl.internal.AuthenticatedSubject kernelIdentity, weblogic.security.acl.internal.AuthenticatedSubject userIdentity)
          On the behalf of the initiator push the subject identity onto the thread stack.
static java.lang.Object runAs(weblogic.security.acl.internal.AuthenticatedSubject kernelIdentity, weblogic.security.acl.internal.AuthenticatedSubject userIdentity, java.security.PrivilegedAction action)
          Execution privileged action on behalf of the user identity.
static java.lang.Object runAs(weblogic.security.acl.internal.AuthenticatedSubject kernelIdentity, weblogic.security.acl.internal.AuthenticatedSubject userIdentity, java.security.PrivilegedExceptionAction action)
          Execution privileged exception action on behalf of the user identity.
static void setDefaultUser(weblogic.security.acl.internal.AuthenticatedSubject user)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityManager

public SecurityManager()
Method Detail

getCurrentSubject

public static weblogic.security.acl.internal.AuthenticatedSubject getCurrentSubject(weblogic.security.acl.internal.AuthenticatedSubject kernelId)
Return the current threads client identity, return an empty Subject instance if the current subject is null.

Parameters:
kernelID - the kernel ID as returned by running doPrivileged on PrivilegedActions.getKernelIdentityAction()
Returns:
Current Subject

pushSubject

public static void pushSubject(weblogic.security.acl.internal.AuthenticatedSubject kernelIdentity,
                               weblogic.security.acl.internal.AuthenticatedSubject userIdentity)
On the behalf of the initiator push the subject identity onto the thread stack.

Parameters:
kernelIdentity - an AuthenticatedSubject representing the kernelID
userIdentity - an AuthenticatedSubject representing the identity to push
Throws:
java.lang.SecurityException - Thrown if the initiator or subject is null, or if the initiator isn't kernel identity.

popSubject

public static void popSubject(weblogic.security.acl.internal.AuthenticatedSubject kernelIdentity)
On the behalf of the initiator pop the subject identity off the thread stack.

Parameters:
kernelIdentity - Initiatating subject identity, must be kernel.
Throws:
java.lang.SecurityException - Thrown if the initiator is null, or if the initiator isn't kernel identity.

runAs

public static java.lang.Object runAs(weblogic.security.acl.internal.AuthenticatedSubject kernelIdentity,
                                     weblogic.security.acl.internal.AuthenticatedSubject userIdentity,
                                     java.security.PrivilegedAction action)
Execution privileged action on behalf of the user identity.

Parameters:
kernelIdentity - Identity of the initiating identity, must be kernel.
userIdentity - Identity to perform action on behalf of.
action - Privileged action to perform.
Returns:
Returns the action result (may be null)
Throws:
java.lang.SecurityException - Thrown if the initiator or subject is null, or if the initiator isn't kernel identity.

runAs

public static java.lang.Object runAs(weblogic.security.acl.internal.AuthenticatedSubject kernelIdentity,
                                     weblogic.security.acl.internal.AuthenticatedSubject userIdentity,
                                     java.security.PrivilegedExceptionAction action)
                              throws java.security.PrivilegedActionException
Execution privileged exception action on behalf of the user identity.

Parameters:
kernelIdentity - Identity of the initiating identity, must be kernel.
userIdentity - Identity to perform action on behalf of.
action - Privileged exception action to perform.
Returns:
Returns the action result (may be null)
Throws:
java.lang.SecurityException - Thrown if the initiator or subject is null, or if the initiator isn't kernel identity.
java.security.PrivilegedActionException - For exceptions generated during execution of the privileged exception action.

checkKernelPermission

public static void checkKernelPermission()
If we are using Java 2 security and on the server, check to see if we currently have RuntimePermission("weblogic.kernelPermission"). Will propogate the AccessController exception if the permission is not available.

isKernelIdentity

public static boolean isKernelIdentity(weblogic.security.acl.internal.AuthenticatedSubject s)
Returns true if the Subject passed in is the kernel identity.

Parameters:
s - the Subject to test for equality with the kernel identity
Returns:
true if the subject is the kernel identity, false otherwise.

checkKernelIdentity

public static void checkKernelIdentity(weblogic.security.acl.internal.AuthenticatedSubject s)
Throws an exception if the Subject passed in is not kernel identity.

Parameters:
s - the Subject to test for equality with the kernel identity
Throws:
weblogic.security.service.NotAuthorizedRuntimeException - if the Subject is not the kernel identity

setDefaultUser

public static void setDefaultUser(weblogic.security.acl.internal.AuthenticatedSubject user)

getDefaultUser

public static weblogic.security.acl.internal.AuthenticatedSubject getDefaultUser()

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81b