Class BaseRealm
- java.lang.Object
-
- com.sun.enterprise.security.auth.realm.Realm
-
- com.sun.enterprise.security.BaseRealm
-
- All Implemented Interfaces:
Comparable
public abstract class BaseRealm extends Realm
Parent class for iAS Realm classes.This class provides default implementation for most of the abstract methods in com.sun.enterprise.security.auth.realm.Realm. Since most of these abstract methods are not supported by Realms there is no need for the subclasses to implement them. The default implementations provided here generally throw an exception if invoked.
- Author:
- Harpreet Singh
-
-
Field Summary
Fields Modifier and Type Field Description static String
JAAS_CONTEXT_PARAM
protected static com.sun.enterprise.util.i18n.StringManager
sm
-
Fields inherited from class com.sun.enterprise.security.auth.realm.Realm
_logger, groupMapper, PARAM_GROUP_MAPPING
-
-
Constructor Summary
Constructors Constructor Description BaseRealm()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addUser(String name, char[] password, String[] groupList)
Adds new user to file realm.void
addUser(String name, String password, String[] groupList)
Deprecated.AuthenticationHandler
getAuthenticationHandler()
Returns an AuthenticationHandler object which can be used to authenticate within this realm.Enumeration
getGroupNames()
Returns names of all the groups in this particular realm.User
getUser(String name)
Returns the information recorded about a particular named user.Enumeration
getUserNames()
Returns names of all the users in this particular realm.void
persist()
Persist the realm data to permanent storagevoid
refresh()
Refreshes the realm data so that new users/groups are visible.void
removeUser(String name)
Remove user from file realm.boolean
supportsUserManagement()
void
updateUser(String name, String newName, char[] password, String[] groups)
Update data for an existing user.void
updateUser(String name, String newName, String password, String[] groups)
Deprecated.-
Methods inherited from class com.sun.enterprise.security.auth.realm.Realm
addAssignGroups, compareTo, getAuthType, getDefaultDigestAlgorithm, getDefaultInstance, getDefaultRealm, getGroupNames, getInstance, getInstance, getJAASContext, getMappedGroupNames, getName, getProperties, getProperty, getRealmNames, getRealmStatsProvier, init, instantiate, instantiate, instantiate, isValidRealm, isValidRealm, refresh, setDefaultRealm, setName, setProperty, toString, unloadInstance, unloadInstance, updateInstance, updateInstance
-
-
-
-
Field Detail
-
JAAS_CONTEXT_PARAM
public static final String JAAS_CONTEXT_PARAM
- See Also:
- Constant Field Values
-
sm
protected static final com.sun.enterprise.util.i18n.StringManager sm
-
-
Method Detail
-
getAuthenticationHandler
public AuthenticationHandler getAuthenticationHandler()
Returns an AuthenticationHandler object which can be used to authenticate within this realm.This method return null always, since AuthenticationHandlers are generally not supported by iAS realms. Subclass can override if necessary.
- Specified by:
getAuthenticationHandler
in classRealm
- Returns:
- An AuthenticationHandler object for this realm (always null)
-
getUserNames
public Enumeration getUserNames() throws BadRealmException
Returns names of all the users in this particular realm.This method always throws a BadRealmException since by default this operation is not supported. Subclasses which support this method can override.
- Specified by:
getUserNames
in classRealm
- Returns:
- enumeration of user names (strings)
- Throws:
BadRealmException
- if realm data structures are bad
-
getUser
public User getUser(String name) throws NoSuchUserException, BadRealmException
Returns the information recorded about a particular named user.This method always throws a BadRealmException since by default this operation is not supported. Subclasses which support this method can override.
- Specified by:
getUser
in classRealm
- Parameters:
name
- name of the user whose information is desired- Returns:
- the user object
- Throws:
NoSuchUserException
- if the user doesn't existBadRealmException
- if realm data structures are bad
-
getGroupNames
public Enumeration getGroupNames() throws BadRealmException
Returns names of all the groups in this particular realm.This method always throws a BadRealmException since by default this operation is not supported. Subclasses which support this method can override.
- Specified by:
getGroupNames
in classRealm
- Returns:
- enumeration of group names (strings)
- Throws:
BadRealmException
- if realm data structures are bad
-
refresh
public void refresh() throws BadRealmException
Refreshes the realm data so that new users/groups are visible.This method always throws a BadRealmException since by default this operation is not supported. Subclasses which support this method can override.
- Specified by:
refresh
in classRealm
- Throws:
BadRealmException
- if realm data structures are bad
-
addUser
public void addUser(String name, char[] password, String[] groupList) throws BadRealmException, IASSecurityException
Adds new user to file realm. User cannot exist already.- Specified by:
addUser
in classRealm
- Parameters:
name
- User name.password
- Cleartext password for the user.groupList
- List of groups to which user belongs.- Throws:
BadRealmException
- If there are problems adding user.IASSecurityException
-
addUser
@Deprecated public void addUser(String name, String password, String[] groupList) throws BadRealmException, IASSecurityException
Deprecated.Adds new user to file realm. User cannot exist already. Deprecated - User of the overloaded method with char[] password is encouraged
-
removeUser
public void removeUser(String name) throws NoSuchUserException, BadRealmException
Remove user from file realm. User must exist.- Specified by:
removeUser
in classRealm
- Parameters:
name
- User name.- Throws:
NoSuchUserException
- If user does not exist.BadRealmException
-
updateUser
@Deprecated public void updateUser(String name, String newName, String password, String[] groups) throws NoSuchUserException, BadRealmException, IASSecurityException
Deprecated.Update data for an existing user. User must exist. Deprecated - User of the overloaded method with char[] password is encouraged
-
updateUser
public void updateUser(String name, String newName, char[] password, String[] groups) throws NoSuchUserException, BadRealmException, IASSecurityException
Update data for an existing user. User must exist.- Specified by:
updateUser
in classRealm
- Parameters:
name
- Current name of the user to update.newName
- New name to give this user. It can be the same as the original name. Otherwise it must be a new user name which does not already exist as a user.password
- Cleartext password for the user. If non-null the user password is changed to this value. If null, the original password is retained.groupList
- List of groups to which user belongs.- Throws:
BadRealmException
- If there are problems adding user.NoSuchUserException
- If user does not exist.IASSecurityException
-
supportsUserManagement
public boolean supportsUserManagement()
- Specified by:
supportsUserManagement
in classRealm
- Returns:
- true if the realm implementation support User Management (add,remove,update user)
-
persist
public void persist() throws BadRealmException
Persist the realm data to permanent storage- Specified by:
persist
in classRealm
- Throws:
BadRealmException
-
-