All Examples  Security Examples  This Package

Class examples.security.rdbmsrealm.RDBMSRealm

java.lang.Object
    |
    +----weblogic.security.acl.AbstractListableRealm
            |
            +----weblogic.security.acl.AbstractManageableRealm
                    |
                    +----examples.security.rdbmsrealm.RDBMSRealm

public class RDBMSRealm
extends weblogic.security.acl.AbstractManageableRealm
implements weblogic.security.acl.DebuggableRealm
RDBMS realm class. Note that due to the design of this implementation, we do not allow empty groups and empty ACLs to exist in the database.

Author:
Copyright (c) 1998-2000 by BEA Systems, Inc. All Rights Reserved.

Variable Index

 o delegatePool
We maintain a pool of delegates, each with its own connection to the database.
 o log
The debugging log.
 o POOL_SIZE
The maximum number of pooled database connections to maintain at any given time.
 o RDBMS_DDL
The name of the realm DDL file we will try to load.
 o RDBMS_PROPS
The name of the realm properties file we will try to load.

Constructor Index

 o RDBMSRealm()
Create a new RDBMS realm object.

Method Index

 o addGroupMember(RDBMSGroup, Principal)
Return an enumeration of all users in the database.
 o authUserPassword(String, String)
Authenticate the given user.
 o createGroup(String, Hashtable)
Factory method for creating new group objects.
 o createUser(String, String)
Factory method for creating new user objects.
 o getAcl(String)
Return the ACL with the given name, or null if the ACL does not exist in the database.
 o getAcls()
Return an enumeration of all ACLs in the database.
 o getDebugLog()
Obtain the debug log, if it is enabled.
 o getDelegate()
Obtain a delegate from the pool.
 o getGroup(String)
Return the group with the given name, or null if the group does not exist in the database.
 o getGroupMembersInternal(String)
 
 o getGroups()
Return an enumeration of all groups in the database.
 o getPermission(String)
Get a Permission that matches the specified name.
 o getPermissions()
Return an enumeration of all permissions in the database.
 o getPrincipal(String)
Return the principal with the given name, or null if the principal does not exist in the database.
 o getUser(String)
Return the user with the given name, or null if the user does not exist in the database.
 o getUsers()
Return an enumeration of all users in the database.
 o newUser(String, Object, Object)
Create a new User.
 o returnDelegate(RDBMSDelegate)
Return a delegate to the pool.
 o setDebug(boolean)
Enable or disable debug logging.

Field Detail

 o RDBMS_PROPS
static final java.lang.String RDBMS_PROPS
          The name of the realm properties file we will try to load.
 o RDBMS_DDL
static final java.lang.String RDBMS_DDL
          The name of the realm DDL file we will try to load.
 o POOL_SIZE
private static final int POOL_SIZE
          The maximum number of pooled database connections to maintain at any given time.
 o delegatePool
protected weblogic.utils.reuse.Pool delegatePool
          We maintain a pool of delegates, each with its own connection to the database. Access to the pool itself is synchronized, but since only one thread will obtain a given delegate from the pool at any time, we don't need to synchronize any other method calls.
See Also:
getDelegate, returnDelegate, RDBMSDelegate$DFactory
 o log
weblogic.logging.LogOutputStream log
          The debugging log. This may be null.

Constructor Detail

 o RDBMSRealm
public RDBMSRealm()
          Create a new RDBMS realm object.

Method Detail

 o getDelegate
protected RDBMSDelegate getDelegate()
          Obtain a delegate from the pool. If the pool is empty, this may cause a new delegate to be created and handed back to us. If a fatal error occurs when you are using a delegate, do not return it to the pool. You can do this by setting your reference to the delegate to null and calling returnDelegate() as usual; it will do the right thing.
Throws:
RDBMSException - an error occurred in communicating with the database
See Also:
returnDelegate
 o returnDelegate
protected void returnDelegate(RDBMSDelegate delegate)
          Return a delegate to the pool. If the delegate was set to null because of errors, nothing is done.
See Also:
getDelegate
 o getUser
public weblogic.security.acl.User getUser(java.lang.String name)
          Return the user with the given name, or null if the user does not exist in the database.
Parameters:
name - the name to obtain
Returns:
the user, or null if none
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
getUser in class weblogic.security.acl.AbstractListableRealm
 o getPrincipal
java.security.Principal getPrincipal(java.lang.String name)
          Return the principal with the given name, or null if the principal does not exist in the database.
Parameters:
name - the name to obtain
Returns:
the principal, or null if none
Throws:
RDBMSException - an error occurred in communicating with the database
 o getGroupMembersInternal
protected java.util.Hashtable getGroupMembersInternal(java.lang.String name)
Overrides:
getGroupMembersInternal in class weblogic.security.acl.AbstractListableRealm
 o getGroup
public java.security.acl.Group getGroup(java.lang.String name)
          Return the group with the given name, or null if the group does not exist in the database.
Parameters:
name - the name to obtain
Returns:
the group, or null if none
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
getGroup in class weblogic.security.acl.AbstractListableRealm
 o getAcl
public java.security.acl.Acl getAcl(java.lang.String name)
          Return the ACL with the given name, or null if the ACL does not exist in the database.
Parameters:
name - the name to obtain
Returns:
the ACL, or null if none
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
getAcl in class weblogic.security.acl.AbstractListableRealm
 o getUsers
public java.util.Enumeration getUsers()
          Return an enumeration of all users in the database. Each element of the Enumeration is a User object.
Returns:
all users
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
getUsers in class weblogic.security.acl.AbstractListableRealm
See Also:
weblogic.security.acl.User
 o addGroupMember
boolean addGroupMember(RDBMSGroup group,
                       java.security.Principal member)
          Return an enumeration of all users in the database. Each element of the Enumeration is a User object.
Returns:
all users
Throws:
RDBMSException - an error occurred in communicating with the database
See Also:
weblogic.security.acl.User
 o getGroups
public java.util.Enumeration getGroups()
          Return an enumeration of all groups in the database. Each element of the Enumeration is a Group object. Note that in this realm, empty groups cannot currently exist.
Returns:
all groups
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
getGroups in class weblogic.security.acl.AbstractListableRealm
See Also:
java.security.acl.Group
 o getAcls
public java.util.Enumeration getAcls()
          Return an enumeration of all ACLs in the database. Each element of the Enumeration is an Acl object. Note that in this realm, empty ACLs cannot currently exist.
Returns:
all ACLs
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
getAcls in class weblogic.security.acl.AbstractListableRealm
See Also:
java.security.acl.Acl
 o getPermissions
public java.util.Enumeration getPermissions()
          Return an enumeration of all permissions in the database. Each element of the Enumeration is a Permission object.
Returns:
all permissions
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
getPermissions in class weblogic.security.acl.AbstractListableRealm
See Also:
java.security.acl.Permission
 o authUserPassword
protected weblogic.security.acl.User authUserPassword(java.lang.String name,
                                java.lang.String passwd)
          Authenticate the given user. If the authentication step passes, a User object is returned for that user, otherwise null is returned.
Returns:
the authenticated user, or null
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
authUserPassword in class weblogic.security.acl.AbstractListableRealm
 o getPermission
public java.security.acl.Permission getPermission(java.lang.String name)
          Get a Permission that matches the specified name. If no such permission exists in the database, null is returned.
Parameters:
name - the name of the permission
Returns:
permission object, or nullp
Throws:
RDBMSException - an error occurred in communicating with the database
Overrides:
getPermission in class weblogic.security.acl.AbstractListableRealm
 o newUser
public weblogic.security.acl.User newUser(java.lang.String name,
                    java.lang.Object credential,
                    java.lang.Object constraints) throws java.lang.SecurityException
          Create a new User.
Parameters:
name - the name of the new user
credential - the password for the user
constraints - null, for this realm
Returns:
the new User
Throws:
java.lang.SecurityException - invalid credential or constraint
Overrides:
newUser in class weblogic.security.acl.AbstractManageableRealm
 o setDebug
public void setDebug(boolean enable)
          Enable or disable debug logging.
 o getDebugLog
public weblogic.logging.LogOutputStream getDebugLog()
          Obtain the debug log, if it is enabled.
 o createUser
RDBMSUser createUser(java.lang.String name,
                     java.lang.String passwd)
          Factory method for creating new user objects.
 o createGroup
RDBMSGroup createGroup(java.lang.String name,
                       java.util.Hashtable members)
          Factory method for creating new group objects.

All Examples  Security Examples  This Package