@Contract public abstract class Realm extends Object implements Comparable
Principal| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
_logger |
protected GroupMapper |
groupMapper |
static String |
PARAM_GROUP_MAPPING |
| Modifier | Constructor and Description |
|---|---|
protected |
Realm()
The default constructor creates a realm which will later
be initialized, either from properties or by deserializing.
|
| Modifier and Type | Method and Description |
|---|---|
protected String[] |
addAssignGroups(String[] grps)
Add assign groups to given Vector of groups.
|
abstract void |
addUser(String name,
char[] password,
String[] groupList)
Adds new user to file realm.
|
int |
compareTo(Object realm)
Compares a realm to another.
|
abstract AuthenticationHandler |
getAuthenticationHandler()
Returns an AuthenticationHandler object which can be used to
authenticate within this realm.
|
abstract String |
getAuthType()
Returns a short (preferably less than fifteen characters) description
of the kind of authentication which is supported by this realm.
|
protected String |
getDefaultDigestAlgorithm() |
static Realm |
getDefaultInstance()
Convenience method which returns the Realm object representing
the current default realm.
|
static String |
getDefaultRealm()
Returns the name of the default realm.
|
abstract Enumeration |
getGroupNames()
Returns names of all the groups in this particular realm.
|
abstract Enumeration |
getGroupNames(String username)
Returns the name of all the groups that this user belongs to
|
static Realm |
getInstance(String name)
Returns the realm identified by the name which is passed
as a parameter.
|
static Realm |
getInstance(String configName,
String name)
Returns the realm identified by the name which is passed
as a parameter.
|
String |
getJAASContext()
Returns name of JAAS context used by this realm.
|
protected ArrayList<String> |
getMappedGroupNames(String group) |
String |
getName()
Returns the name of this realm.
|
protected Properties |
getProperties()
Return properties of the realm.
|
String |
getProperty(String name)
Get a realm property.
|
static Enumeration |
getRealmNames()
Returns the names of accessible realms.
|
static void |
getRealmStatsProvier() |
abstract User |
getUser(String name)
Returns the information recorded about a particular named user.
|
abstract Enumeration |
getUserNames()
Returns names of all the users in this particular realm.
|
protected void |
init(Properties props)
Initialize a realm with some properties.
|
static Realm |
instantiate(String realmName,
File f)
Deprecated.
|
static Realm |
instantiate(String name,
String className,
Properties props)
Instantiate a Realm with the given name and properties using the
Class name given.
|
static Realm |
instantiate(String name,
String className,
Properties props,
String configName)
Instantiate a Realm with the given name and properties using the
Class name given.
|
static boolean |
isValidRealm(String name)
Checks if the given realm name is loaded/valid.
|
static boolean |
isValidRealm(String configName,
String name)
Checks if the given realm name is loaded/valid.
|
abstract void |
persist()
Persist the realm data to permanent storage
|
abstract void |
refresh()
Refreshes the realm data so that new users/groups are visible.
|
void |
refresh(String configName)
Refreshes the realm data so that new users/groups are visible.
|
abstract void |
removeUser(String name)
Remove user from file realm.
|
static void |
setDefaultRealm(String realmName)
Sets the name of the default realm.
|
protected void |
setName(String name)
Assigns the name of this realm, and stores it in the cache
of realms.
|
void |
setProperty(String name,
String value)
Set a realm property.
|
abstract boolean |
supportsUserManagement() |
String |
toString()
Returns the name of this realm.
|
static void |
unloadInstance(String realmName)
Remove realm with given name from cache.
|
static void |
unloadInstance(String configName,
String realmName)
Remove realm with given name from cache.
|
protected static void |
updateInstance(Realm realm,
String name)
Replace a Realm instance.
|
protected static void |
updateInstance(String configName,
Realm realm,
String name)
Replace a Realm instance.
|
abstract void |
updateUser(String name,
String newName,
char[] password,
String[] groups)
Update data for an existing user.
|
public static final String PARAM_GROUP_MAPPING
protected GroupMapper groupMapper
protected static final Logger _logger
protected Realm()
public final String getName()
protected String getDefaultDigestAlgorithm()
protected final void setName(String name)
name - name to be assigned to this realm.public String toString()
public int compareTo(Object realm)
compareTo in interface Comparablepublic static Realm instantiate(String name, String className, Properties props) throws BadRealmException
name - Name of the new realm.className - Java Class name of the realm to create.props - Properties containing values of the Property element
from server.xmlBadRealmException - If the requested realm cannot be instantiated.public static Realm instantiate(String name, String className, Properties props, String configName) throws BadRealmException
name - Name of the new realm.className - Java Class name of the realm to create.props - Properties containing values of the Property element
from server.xmlconfigName - the config to which this realm belongsBadRealmException - If the requested realm cannot be instantiated.public static void getRealmStatsProvier()
public static Realm instantiate(String realmName, File f) throws NoSuchRealmException, BadRealmException, FileNotFoundException
realmName - Name of the new realm.f - File containing Properties for the new realm.NoSuchRealmExceptionBadRealmExceptionFileNotFoundExceptionprotected static void updateInstance(Realm realm, String name)
Minimal error checking is done. The realm being replaced must already exist (instantiate() was previously called), the new instance must be fully initialized properly and it must of course be of the same class as the previous instance.
realm - The new realm instance.name - The (previously instantiated) name for this realm.protected static void updateInstance(String configName, Realm realm, String name)
Minimal error checking is done. The realm being replaced must already exist (instantiate() was previously called), the new instance must be fully initialized properly and it must of course be of the same class as the previous instance.
realm - The new realm instance.name - The (previously instantiated) name for this realm.public static Realm getDefaultInstance() throws NoSuchRealmException
NoSuchRealmException - if default realm does not existpublic static String getDefaultRealm()
public static void setDefaultRealm(String realmName)
realmName - Name of realm to set as default.public static void unloadInstance(String realmName) throws NoSuchRealmException
realmName - NoSuchRealmExceptionpublic static void unloadInstance(String configName, String realmName) throws NoSuchRealmException
realmName - NoSuchRealmExceptionpublic void setProperty(String name, String value)
name - property name.value - property value.public String getProperty(String name)
name - property name.protected Properties getProperties()
public String getJAASContext()
The JAAS context is defined in server.xml auth-realm element associated with this realm.
public static Realm getInstance(String name) throws NoSuchRealmException
name - identifies the realmNoSuchRealmException - if the realm is invalidBadRealmException - if realm data structures are badpublic static Realm getInstance(String configName, String name) throws NoSuchRealmException
name - identifies the realmNoSuchRealmException - if the realm is invalidBadRealmException - if realm data structures are badpublic static Enumeration getRealmNames()
protected void init(Properties props) throws BadRealmException, NoSuchRealmException
props - initialization parameters used by this realm.BadRealmException - if the configuration parameters
identify a corrupt realmNoSuchRealmException - if the configuration parameters
specify a realm which doesn't existpublic static boolean isValidRealm(String name)
String - name of the realm to check.public static boolean isValidRealm(String configName, String name)
String - name of the realm to check.protected String[] addAssignGroups(String[] grps)
grps - public abstract String getAuthType()
public abstract AuthenticationHandler getAuthenticationHandler()
public abstract Enumeration getUserNames() throws BadRealmException
BadRealmException - if realm data structures are badpublic abstract User getUser(String name) throws NoSuchUserException, BadRealmException
name - name of the user whose information is desiredNoSuchUserException - if the user doesn't existBadRealmException - if realm data structures are badpublic abstract Enumeration getGroupNames() throws BadRealmException
BadRealmException - if realm data structures are badpublic abstract Enumeration getGroupNames(String username) throws InvalidOperationException, NoSuchUserException
username - name of the user in this realm whose group listing
is needed.InvalidOperationException - thrown if the realm does not
support this operation - e.g. Certificate realm does not support this
operationNoSuchUserExceptionpublic abstract void refresh()
throws BadRealmException
BadRealmException - if realm data structures are badpublic void refresh(String configName) throws BadRealmException
BadRealmException - if realm data structures are badpublic abstract void addUser(String name, char[] password, String[] groupList) throws BadRealmException, IASSecurityException
name - User name.password - Cleartext password for the user.groupList - List of groups to which user belongs.BadRealmException - If there are problems adding user.IASSecurityExceptionpublic abstract void removeUser(String name) throws NoSuchUserException, BadRealmException
name - User name.NoSuchUserException - If user does not exist.BadRealmExceptionpublic abstract void updateUser(String name, String newName, char[] password, String[] groups) throws NoSuchUserException, BadRealmException, IASSecurityException
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.BadRealmException - If there are problems adding user.NoSuchUserException - If user does not exist.IASSecurityExceptionpublic abstract boolean supportsUserManagement()
public abstract void persist()
throws BadRealmException
BadRealmExceptionCopyright © 2017. All rights reserved.