org.norther.tammi.core.realm
Interface MemoryRealm

All Superinterfaces:
Configurable, Realm
All Known Implementing Classes:
DefaultMemoryRealm

public interface MemoryRealm
extends Realm

An interface to realms keeping their user base in memory. The realm can also be loaded from a property file by using the following syntax:

 ##
 # A new user and password.
 # 'user'.password = 'password'
 admin.password = secret
 guest.password =
 ##
 # Roles of the user.
 # 'user'.roles = 'role'
 admin.roles = admin
 ##
 # Locale of the user.
 # 'user'.locale = 'ln'_'CN'
 admin.locale = en_US
 ##
 # The default role to use.
 default.role = user
 ##
 # An anonymous user.
 anonymous.user = guest
 ##
 # A digest algorithm.
 digest.algorithm = MD5
 

Based on Realm in the Apache Jakarta Tomcat project.

Author:
Craig R. McClanahan, Ilkka Priha

Field Summary
static String LOCALE_PROPERTY
          The locale property.
static String PASSWORD_PROPERTY
          The password property.
static String ROLES_PROPERTY
          The roles property.
 
Fields inherited from interface org.norther.tammi.core.realm.Realm
ANONYMOUS_USER_PROPERTY, CACHED_PASSWORDS_PROPERTY, DEFAULT_ROLE_PROPERTY, DIGEST_ALGORITHM_PROPERTY, MEMBER_PROPERTY, PUBLIC_NAME_PROPERTY
 
Method Summary
 void addRole(String username, String role)
          Adds a role.
 void addUser(String username, String password)
          Adds a new user.
 void addUser(String username, String password, List roles)
          Adds a new user with roles.
 void changePassword(String username, String password)
          Changes the password.
 List getRoles(String username)
          Gets roles.
 void removeRole(String username, String role)
          Removes a role.
 void removeUser(String username)
          Removes a user.
 void setRoles(String username, List roles)
          Sets roles.
 
Methods inherited from interface org.norther.tammi.core.realm.Realm
authenticate, authenticate, authenticate, authenticate, authenticate, authenticate, authenticate, authenticate, digest, generateAuthenticate, getAnonymousUser, getAuthType, getDefaultRole, getDigestAlgorithm, getPublicName, identify, identify, isAuthenticated, isAuthenticated, isCachedPasswords, isUserInRole, setAnonymousUser, setCachedPasswords, setDefaultRole, setDigestAlgorithm, setPublicName
 
Methods inherited from interface org.norther.tammi.core.config.Configurable
addProperty, addProperty, clearProperties, containsProperty, getConfigKey, getProperties, getProperty, getPropertyFilePath, indexOfProperty, propertyMap, propertyMap, removeProperty, removeProperty, setConfigKey, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, storeProperties
 

Field Detail

PASSWORD_PROPERTY

static final String PASSWORD_PROPERTY
The password property.

See Also:
Constant Field Values

ROLES_PROPERTY

static final String ROLES_PROPERTY
The roles property.

See Also:
Constant Field Values

LOCALE_PROPERTY

static final String LOCALE_PROPERTY
The locale property.

See Also:
Constant Field Values
Method Detail

addUser

void addUser(String username,
             String password)
             throws LogException
Adds a new user.

Parameters:
username - the username.
password - the password.
Throws:
LogException - if already exists.

addUser

void addUser(String username,
             String password,
             List roles)
             throws LogException
Adds a new user with roles.

Parameters:
username - the username.
password - the password.
roles - a list of roles.
Throws:
LogException - if already exists.

changePassword

void changePassword(String username,
                    String password)
                    throws LogException
Changes the password.

Parameters:
username - the username.
password - the password.
Throws:
LogException - if not found.

addRole

void addRole(String username,
             String role)
             throws LogException
Adds a role.

Parameters:
username - the username.
role - the role to add.
Throws:
LogException - if not found.

removeRole

void removeRole(String username,
                String role)
                throws LogException
Removes a role.

Parameters:
username - the username.
role - the role to remove.
Throws:
LogException - if not found.

getRoles

List getRoles(String username)
              throws LogException
Gets roles.

Parameters:
username - the username.
Returns:
a list of roles.
Throws:
LogException - if not found.

setRoles

void setRoles(String username,
              List roles)
              throws LogException
Sets roles.

Parameters:
username - the username.
roles - a list of roles.
Throws:
LogException - if not found.

removeUser

void removeUser(String username)
Removes a user.

Parameters:
username - the username.


Copyright © 2004 The Norther Organization. All rights reserved.