|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.config.DefaultConfigurable
org.norther.tammi.core.realm.AbstractRealm
public abstract class AbstractRealm
An abstract implementation of Realm.
Based on RealmBase in the Apache Jakarta Tomcat project.
| Field Summary |
|---|
| Fields inherited from class org.norther.tammi.core.config.DefaultConfigurable |
|---|
MODIFIED, SYNCHRONIZED, UNMODIFIED |
| Fields inherited from class org.norther.tammi.core.base.Adaptee |
|---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
| 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 |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
AbstractRealm()
Constructs a new realm. |
|
AbstractRealm(String digest)
Constructs a new realm with a digest. |
|
| Method Summary | |
|---|---|
protected boolean |
addRoles(AuthenticatedPrincipal principal,
List roles)
Adds roles for the specified authenticated principal. |
Principal |
authenticate(Certificate[] certs)
Authenticates the principal with a certificate. |
Principal |
authenticate(Principal principal,
String scheme)
Authenticates the specified principal in this realm. |
Principal |
authenticate(String domain,
Certificate[] certs)
Authenticates the principal with a certicate in the specified domain. |
Principal |
authenticate(String domain,
Principal principal,
String scheme)
Authenticates the specified principal in the specified domain of this realm. |
Principal |
authenticate(String username,
String password,
String scheme)
Authenticates the principal associated with the specified username and password using the specified scheme, if there is one. |
Principal |
authenticate(String domain,
String username,
String password,
String scheme)
Authenticates the principal associated with the specified username and password in the specified domain using the specified scheme, if there is one. |
Principal |
authenticate(String username,
String realmname,
String resp,
String nonce,
String nc,
String cnonce,
String qop,
String md5a2,
String encoding)
Authenticates the principal associated with the specified username matching the digest calculated using the given parameters using the method described in RFC2617/2831. |
Principal |
authenticate(String domain,
String username,
String realmname,
String resp,
String nonce,
String nc,
String cnonce,
String qop,
String md5a2,
String encoding)
Authenticates the principal associated with the specified username in the specified domain matching the digest calculated using the given parameters using the method described in RFC2617/2831. |
protected void |
checkProperties()
Checks properties. |
protected AuthenticatedPrincipal |
createPrincipal(String domain,
Locale locale,
Object id,
String username,
String credentials)
Creates a user principal instance representing the authenticated user. |
protected AuthenticatedPrincipal |
createPrincipal(String domain,
Locale locale,
Object id,
String username,
String credentials,
String realName)
Creates a user principal instance with the full name representing the authenticated user. |
String |
digest(String username,
String password)
Digests the password for the specified username using the defined algorithm and converts the result to a corresponding hexadecimal string. |
String |
generateAuthenticate(String username,
String password,
String scheme)
Generates the authentication header. |
String |
getAnonymousUser()
Gets the username for anonymous principals. |
String |
getAuthType()
Gets the authentication scheme. |
String |
getDefaultRole()
Gets the default role of authenticated principals. |
String |
getDigestAlgorithm()
Gets the digest algorithm used to store credentials. |
protected Map |
getMemberMap()
Gets the member map. |
protected MessageDigest |
getMessageDigest()
Gets the message digest to apply to credentials, if any. |
protected abstract Principal |
getPrincipal(String domain,
String username,
String password)
Gets the user principal representing the authenticated user. |
String |
getPublicName()
Gets the public name of this realm. |
Principal |
identify(String identity)
Identifies the principal associated with the specified identity. |
Principal |
identify(String username,
String password)
Identifies the principal associated with the specified username and password. |
boolean |
isAuthenticated(Principal principal)
Checks whether the specified principal is authenticated in this realm. |
boolean |
isAuthenticated(String domain,
Principal principal)
Checks whether the specified principal is authenticated in the specified domain of this realm. |
boolean |
isCachedPasswords()
Checks whether non-digested client passwords are cached. |
boolean |
isUserInRole(Principal principal,
String role)
Checks whether the specified principal is in the specified security role within the context of any domain in this realm. |
void |
setAnonymousUser(String username)
Sets the username for anonymous principals. |
void |
setCachedPasswords(boolean flag)
Sets the option to cache non-digested client passwords of authenticated principals to be used in e.g. |
void |
setDefaultRole(String role)
Sets the default role of authenticated principals. |
void |
setDigestAlgorithm(String digest)
Sets the digest algorithm used to store credentials. |
void |
setPublicName(String name)
Sets the public name of this realm. |
protected void |
updateProperties()
Updates properties. |
| Methods inherited from class org.norther.tammi.core.config.DefaultConfigurable |
|---|
addProperty, addProperty, clearProperties, containsProperty, getConfigKey, getConfiguration, getModifiedState, getProperties, getProperty, getPropertyFilePath, indexOfProperty, loadConfiguration, loadConfiguration, loadConfiguration, modified, propertyMap, propertyMap, removeProperty, removeProperty, setConfigKey, setModifiedState, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, storeProperties |
| Methods inherited from class org.norther.tammi.core.base.Adaptee |
|---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 |
| Constructor Detail |
|---|
public AbstractRealm()
public AbstractRealm(String digest)
digest - the digest algorithm.| Method Detail |
|---|
public String getPublicName()
Realm
getPublicName in interface Realmpublic void setPublicName(String name)
RealmNote that if both the digest algorithm and the public name are defined, the digested passwords must include the username and the realmname in the form: <username>:<realmname>:<password>.
setPublicName in interface Realmname - the public name.public String getDigestAlgorithm()
Realm
getDigestAlgorithm in interface Realmpublic void setDigestAlgorithm(String digest)
Realm
setDigestAlgorithm in interface Realmdigest - the digest algorithm.public boolean isCachedPasswords()
Realm
isCachedPasswords in interface Realmpublic void setCachedPasswords(boolean flag)
Realm
setCachedPasswords in interface Realmflag - the cached passwords option.public String getDefaultRole()
Realm
getDefaultRole in interface Realmpublic void setDefaultRole(String role)
Realm
setDefaultRole in interface Realmrole - the default role.public String getAnonymousUser()
Realm
getAnonymousUser in interface Realmpublic void setAnonymousUser(String username)
RealmNote that the anonymous user must be known within the realm but its credentials are not necessarily verified during authentication.
setAnonymousUser in interface Realmusername - the default guest.
public boolean isUserInRole(Principal principal,
String role)
Realm
isUserInRole in interface Realmprincipal - the principal for whom the role is to be checked.role - the security role to be checked.
public boolean isAuthenticated(Principal principal)
Realm
isAuthenticated in interface Realmprincipal - the principal to be checked.
public boolean isAuthenticated(String domain,
Principal principal)
Realm
isAuthenticated in interface Realmdomain - the domain of the user.principal - the principal to be checked.
public Principal identify(String identity)
Realm
identify in interface Realmidentity - the identity.
public Principal identify(String username,
String password)
Realm
identify in interface Realmusername - the username.password - the password.
public Principal authenticate(Principal principal,
String scheme)
Realm
authenticate in interface Realmprincipal - principal to be authenticated.scheme - the authentication scheme to be applied.
public Principal authenticate(String domain,
Principal principal,
String scheme)
Realm
authenticate in interface Realmdomain - the domain of the user.principal - principal to be authenticated.scheme - the authentication scheme to be applied.
public Principal authenticate(String username,
String password,
String scheme)
RealmThe username can be null or empty for an anonymous authentication.
authenticate in interface Realmusername - the username to look up.password - the password to use in authentication.scheme - the authentication scheme to be applied.
public Principal authenticate(String domain,
String username,
String password,
String scheme)
RealmThe username can be null or empty for an anonymous authentication.
authenticate in interface Realmdomain - the domain of the user.username - the username to look up.password - the password to use in authentication.scheme - the authentication scheme to be applied.
public Principal authenticate(String username,
String realmname,
String resp,
String nonce,
String nc,
String cnonce,
String qop,
String md5a2,
String encoding)
RealmNote that either non-encrypted or MD5 digested passwords must be applied. Digested passwords must include the username and realmname in the form: <username>:<realmname>:<password>.
The username can be null or empty for an anonymous authentication.
authenticate in interface Realmusername - the username to look up.realmname - the realm, i.e. the identification of the server.resp - the digest which has been submitted by the client.nonce - a unique token which has been used for this request.nc - a nonce count.cnonce - a client nonce.qop - the quality of protection ("auth", "auth-int",...)md5a2 - the second MD5 digest used to calculate the digest:
MD5(Method + ':' + uri).encoding - the chareacter encoding to apply.
public Principal authenticate(String domain,
String username,
String realmname,
String resp,
String nonce,
String nc,
String cnonce,
String qop,
String md5a2,
String encoding)
RealmNote that either non-encrypted or MD5 digested passwords must be applied. Digested passwords must include the username and realmname in the form: <username>:<realmname>:<password>.
The username can be null or empty for an anonymous authentication.
authenticate in interface Realmdomain - the domain of the user.username - the username to look up.realmname - the realm, i.e. the identification of the server.resp - the digest which has been submitted by the client.nonce - a unique token which has been used for this request.nc - a nonce count.cnonce - a client nonce.qop - the quality of protection ("auth", "auth-int",...)md5a2 - the second MD5 digest used to calculate the digest:
MD5(Method + ':' + uri).encoding - the character encoding to apply.
public Principal authenticate(Certificate[] certs)
Realm
authenticate in interface Realmcerts - the peer certificate chain.
public Principal authenticate(String domain,
Certificate[] certs)
Realm
authenticate in interface Realmdomain - the domain of the user.certs - the peer certificate chain.
public String getAuthType()
Realm
getAuthType in interface Realm
public String generateAuthenticate(String username,
String password,
String scheme)
RealmThe username can be null or empty for an anonymous authentication.
generateAuthenticate in interface Realmusername - the username to look up.password - the password to use in authentication.scheme - the authentication scheme to be used.
public String digest(String username,
String password)
Realm
digest in interface Realmusername - the username.password - the password or other credentials.
protected MessageDigest getMessageDigest()
protected Map getMemberMap()
protected void checkProperties()
protected void updateProperties()
protected AuthenticatedPrincipal createPrincipal(String domain,
Locale locale,
Object id,
String username,
String credentials)
domain - the domain.locale - the locale.id - the identification.username - the username.credentials - the server credentials.
protected AuthenticatedPrincipal createPrincipal(String domain,
Locale locale,
Object id,
String username,
String credentials,
String realName)
domain - the domain.locale - the locale.id - the identification.username - the username.credentials - the server credentials.realName - the real name.
protected boolean addRoles(AuthenticatedPrincipal principal,
List roles)
principal - the principal.roles - a list of roles.
protected abstract Principal getPrincipal(String domain,
String username,
String password)
domain - the domain.username - the username.password - the user password.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||