Class BaseRealm
- java.lang.Object
-
- com.sun.enterprise.security.auth.realm.AbstractRealm
-
- com.sun.enterprise.security.auth.realm.AbstractStatefulRealm
-
- com.sun.enterprise.security.auth.realm.Realm
-
- com.sun.enterprise.security.BaseRealm
-
- All Implemented Interfaces:
Comparable<Realm>
- Direct Known Subclasses:
AppservRealm
,CertificateRealm
,DigestRealmBase
,FileRealm
,LDAPRealm
,SolarisRealm
public abstract class BaseRealm extends Realm
Parent class for Payara 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 protected static StringManager
sm
-
Fields inherited from class com.sun.enterprise.security.auth.realm.Realm
_logger, JAAS_CONTEXT_PARAM, RI_DEFAULT
-
Fields inherited from class com.sun.enterprise.security.auth.realm.AbstractStatefulRealm
groupMapper, GROUPS_SEP, PARAM_DEFAULT_DIGEST_ALGORITHM, PARAM_GROUP_MAPPING, PARAM_GROUPS
-
-
Constructor Summary
Constructors Constructor Description BaseRealm()
-
Method Summary
All Methods Instance Methods Concrete 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)
Adds new user to file realm.Enumeration<String>
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<String>
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)
Update data for an existing user.-
Methods inherited from class com.sun.enterprise.security.auth.realm.Realm
getDefaultInstance, getDefaultRealm, getInstance, getInstance, getRealmNames, getRealmStatsProvier, instantiate, instantiate, isValidRealm, isValidRealm, setDefaultRealm, unloadInstance, unloadInstance, updateInstance, updateInstance
-
Methods inherited from class com.sun.enterprise.security.auth.realm.AbstractStatefulRealm
addAssignGroups, compareTo, getDefaultDigestAlgorithm, getJAASContext, getMappedGroupNames, getName, getProperties, getProperty, init, refresh, setName, setProperty, toString
-
Methods inherited from class com.sun.enterprise.security.auth.realm.AbstractRealm
getAuthType, getGroupNames
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Field Detail
-
sm
protected static final StringManager sm
-
-
Method Detail
-
getUserNames
public Enumeration<String> 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 classAbstractRealm
- 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 classAbstractRealm
- 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<String> 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 classAbstractRealm
- 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 classAbstractRealm
- 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 classAbstractRealm
- 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
public void addUser(String name, String password, String[] groupList) throws BadRealmException, IASSecurityException
Adds new user to file realm. User cannot exist already.
-
removeUser
public void removeUser(String name) throws NoSuchUserException, BadRealmException
Remove user from file realm. User must exist.- Specified by:
removeUser
in classAbstractRealm
- Parameters:
name
- User name.- Throws:
NoSuchUserException
- If user does not exist.BadRealmException
-
updateUser
public void updateUser(String name, String newName, String password, String[] groups) throws NoSuchUserException, BadRealmException, IASSecurityException
Update data for an existing user. User must exist.
-
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 classAbstractRealm
- 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.groups
- 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 classAbstractRealm
- 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 classAbstractRealm
- Throws:
BadRealmException
-
-