Top Description Methods
org.apache.catalina

public Interface UserDatabase

Known Direct Implementers
org.apache.catalina.users.MemoryUserDatabase, org.apache.catalina.users.SparseUserDatabase
Imports
java.util.Iterator

Abstract representation of a database of Users and Groups that can be maintained by an application, along with definitions of corresponding Roles, and referenced by a Realm for authentication and access control.
Author
Craig R. McClanahan
Since
4.1

Method Summary

Modifier and TypeMethod and Description
public default void
backgroundProcess()

Perform any background processing (e.g. checking for changes in persisted storage) required for the user database.

public void
close()

Finalize access to this user database.

public Group

Returns:

The new group
createGroup
(String
The group name of the new group (must be unique)
groupname
,
String
The description of this group
description
)

Create and return a new Group defined in this user database.

public Role

Returns:

The new role
createRole
(String
The role name of the new role (must be unique)
rolename
,
String
The description of this role
description
)

Create and return a new Role defined in this user database.

public User

Returns:

The new user
createUser
(String
The logon username of the new user (must be unique)
username
,
String
The logon password of the new user
password
,
String
The full name of the new user
fullName
)

Create and return a new User defined in this user database.

public Group

Returns:

the Group with the specified group name, if any; otherwise return null.
findGroup
(String
Name of the group to return
groupname
)

public Role

Returns:

the Role with the specified role name, if any; otherwise return null.
findRole
(String
Name of the role to return
rolename
)

public User

Returns:

the User with the specified user name, if any; otherwise return null.
findUser
(String
Name of the user to return
username
)

public Iterator<Group>

Returns:

the set of Groups defined in this user database.
getGroups
()

public String

Returns:

the unique global identifier of this user database.
getId
()

public Iterator<Role>

Returns:

the set of Roles defined in this user database.
getRoles
()

public Iterator<User>

Returns:

the set of Users defined in this user database.
getUsers
()

public default boolean

Returns:

true
isAvailable
()

Is the database available.

public default boolean

Returns:

false
isSparse
()

Is the database data loaded on demand.

public default void
modifiedGroup(Group
The group that has been modified
group
)

Signal the specified Group from this user database has been modified.

public default void
modifiedRole(Role
The role that has been modified
role
)

Signal the specified Role from this user database has been modified.

public default void
modifiedUser(User
The user that has been modified
user
)

Signal the specified User from this user database has been modified.

public void
open()

Initialize access to this user database.

public void
removeGroup(Group
The group to be removed
group
)

Remove the specified Group from this user database.

public void
removeRole(Role
The role to be removed
role
)

Remove the specified Role from this user database.

public void
removeUser(User
The user to be removed
user
)

Remove the specified User from this user database.

public void
save()

Save any updated information to the persistent storage location for this user database.

Method Detail

backgroundProcessback to summary
public default void backgroundProcess()

Perform any background processing (e.g. checking for changes in persisted storage) required for the user database.

closeback to summary
public void close() throws Exception

Finalize access to this user database.

Exceptions
Exception:
if any exception is thrown during closing
createGroupback to summary
public Group createGroup(String groupname, String description)

Create and return a new Group defined in this user database.

Parameters
groupname:String

The group name of the new group (must be unique)

description:String

The description of this group

Returns:Group

The new group

createRoleback to summary
public Role createRole(String rolename, String description)

Create and return a new Role defined in this user database.

Parameters
rolename:String

The role name of the new role (must be unique)

description:String

The description of this role

Returns:Role

The new role

createUserback to summary
public User createUser(String username, String password, String fullName)

Create and return a new User defined in this user database.

Parameters
username:String

The logon username of the new user (must be unique)

password:String

The logon password of the new user

fullName:String

The full name of the new user

Returns:User

The new user

findGroupback to summary
public Group findGroup(String groupname)
Parameters
groupname:String

Name of the group to return

Returns:Group

the Group with the specified group name, if any; otherwise return null.

findRoleback to summary
public Role findRole(String rolename)
Parameters
rolename:String

Name of the role to return

Returns:Role

the Role with the specified role name, if any; otherwise return null.

findUserback to summary
public User findUser(String username)
Parameters
username:String

Name of the user to return

Returns:User

the User with the specified user name, if any; otherwise return null.

getGroupsback to summary
public Iterator<Group> getGroups()
Returns:Iterator<Group>

the set of Groups defined in this user database.

getIdback to summary
public String getId()
Returns:String

the unique global identifier of this user database.

getRolesback to summary
public Iterator<Role> getRoles()
Returns:Iterator<Role>

the set of Roles defined in this user database.

getUsersback to summary
public Iterator<User> getUsers()
Returns:Iterator<User>

the set of Users defined in this user database.

isAvailableback to summary
public default boolean isAvailable()

Is the database available.

Returns:boolean

true

isSparseback to summary
public default boolean isSparse()

Is the database data loaded on demand. This is used to avoid eager loading of the full database data, for example for JMX registration of all objects.

Returns:boolean

false

modifiedGroupback to summary
public default void modifiedGroup(Group group)

Signal the specified Group from this user database has been modified.

Parameters
group:Group

The group that has been modified

modifiedRoleback to summary
public default void modifiedRole(Role role)

Signal the specified Role from this user database has been modified.

Parameters
role:Role

The role that has been modified

modifiedUserback to summary
public default void modifiedUser(User user)

Signal the specified User from this user database has been modified.

Parameters
user:User

The user that has been modified

openback to summary
public void open() throws Exception

Initialize access to this user database.

Exceptions
Exception:
if any exception is thrown during opening
removeGroupback to summary
public void removeGroup(Group group)

Remove the specified Group from this user database.

Parameters
group:Group

The group to be removed

removeRoleback to summary
public void removeRole(Role role)

Remove the specified Role from this user database.

Parameters
role:Role

The role to be removed

removeUserback to summary
public void removeUser(User user)

Remove the specified User from this user database.

Parameters
user:User

The user to be removed

saveback to summary
public void save() throws Exception

Save any updated information to the persistent storage location for this user database.

Exceptions
Exception:
if any exception is thrown during saving