|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface JndiRealm
An interface to realms working with a directory server accessed via the Java Naming and Directory Interface (JNDI) APIs.
The following constraints are imposed on the data structure in the underlying directory server:
DirContext that is accessed via the
connectionURL property.userNamePattern property.userNamePattern property is not
specified, a unique element can be located by searching the directory
context. In this case:
userSearchPattern property specifies the search
filter after substitution of the username.userBase property can be set to the name that is the
base of the subtree containing users. If not specified, the search base is
the top-level context.userSearchScope property can be set to search one
sublevel or the entire subtree of the directory context. The default value of
0 requests a search of only the current level.userPasswordAttribute property is not specified.userPasswordAttribute
property is specified, in which case:
userPasswordAttribute property.RealmMBean digest to the
cleartext string.DirContext
that is accessed via the connectionURL property. This element
has the following characteristics:
roleSearchPattern property.roleSearchPattern property specifies the search
filter after substitution of the distinguished name, and/or the username, of
the authenticated user for which roles will be retrieved.roleBase property can be set to the name that is the
base of the search for matching roles. If not specified, the entire context
will be searched.roleSearchScope property can be set to search one
sublevel or the entire subtree of the directory context. The default value of
0 requests a search of only the current level.roleNameAttribute property) containing the name of the role
represented by this element.userRoleNameAttribute property.Some of the properties can also be specified in a property file using the following syntax (all properties with a java prefix are passed to the context as its environment):
##
# JNDI properties.
#java.naming.provider.url: ldap://tammi.norther.org
#java.naming.security.authentication: DIGEST-MD5
#java.naming.security.principal: ldap@norther.org
#java.naming.security.credentials: secret
##
# A role with members from a directory group.
# 'role'.member = 'group'
admin.member = Domain Admins
user.member = Domain Users
guest.member = Domain Guests
##
# The default role to give for an authenticated principal.
default.role = user
##
# An account for an anonymous user.
anonymous.user = Guest
##
# A digest algorithm.
#digest.algorithm = MD5
##
# The user base.
user.base = cn=users,dc=norther,dc=org
##
# The user search scope (0 = current, 1 = one level down, 2 = directory tree).
user.search.scope = 1
##
# The user search pattern.
user.search.pattern = (&(objectclass=user) (sAMAccountName={0}))
##
# The username pattern (an alternative to the search pattern).
#username.pattern = cn={0},ou=tammi,o=norther
##
# A password attribute (if applicable, otherwise bind is applied).
#password.attribute = userPassword
##
# The role base.
role.base = dc=norther,dc=org
##
# The role search scope (0 = current, 1 = one level down, 2 = directory tree).
role.search.scope = 2
##
# The role search pattern.
role.search.pattern = (&(objectclass=group) (member={0}))
##
# A role name attribute.
role.name.attribute = cn
##
# A user role name attribute (if applicable).
#user.role.name.attribute = memberof
##
# A default locale attribute (if applicable).
#default.locale.attribute = defaultLocale
If role members are not specified, the directory groups themselves are used as roles.
Based on JNDIRealm in the Apache Jakarta Tomcat project.
| Field Summary |
|---|
| 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 | |
|---|---|
Attributes |
getAttributes(String name)
Gets all attributes associated with the named directory object. |
String |
getDefaultLocaleAttribute()
Gets the default locale attribute used to retrieve user locale from the result of of user search. |
String |
getInitialContextFactory()
Gets the JNDI initial context factory to apply. |
String |
getPasswordAttribute()
Gets the password attribute used to retrieve the user password. |
String |
getProviderURL()
Gets the provider URL to the directory of this realm. |
String |
getReferral()
Gets the referrals processing instruction. |
String |
getRoleBase()
Gets the base name for role searches. |
String |
getRoleNameAttribute()
Gets the role name attribute used to retrieve user roles from the result of the role search. |
String |
getRoleSearchPattern()
Gets the message format used to select roles for a user, with "{0}" marking the spot where the distinguished name of the user goes, and/or "{1}" marking the spot for the username of the principal. |
int |
getRoleSearchScope()
Gets the scope for role searches. |
String |
getSecurityAuthentication()
Gets the authentication level of the connection to the directory. |
String |
getSecurityPrincipal()
Gets the principal for authenticating the connection to the directory. |
String |
getSecurityProtocol()
Gets the protocol of the connection to the directory. |
String |
getUserBase()
Gets the base name for user searches. |
String |
getUsernamePattern()
Gets the message format pattern used to form the distinguished name of a user with "{0}" marking the spot where the specified username goes. |
String |
getUserRoleNameAttribute()
Gets the user role name attribute used to retrieve user roles from the result of of user search. |
String |
getUserSearchPattern()
Gets the message format pattern for searching users in this realm with "{0}" marking the spot where the username goes. |
int |
getUserSearchScope()
Gets the scope for user searches. |
DirContext |
lookup()
Returns a new connection to the directory that can be accessed concurrently. |
List |
search(String name,
String filter,
int scope)
Searches in the named context or object for entries that satisfy the given search filter and within the given scope. |
void |
setDefaultLocaleAttribute(String name)
Sets the default locale attribute used to retrieve user locale from the result of of user search. |
void |
setInitialContextFactory(String factory)
Sets the JNDI initial context factory to apply. |
void |
setPasswordAttribute(String name)
Sets the password attribute used to retrieve the user password. |
void |
setProviderURL(String URL)
Sets the provider URL to the directory of this realm. |
void |
setReferral(String instruction)
Sets the referrals processing instruction as specified by the javax.naming.Context inteface, e.g. |
void |
setRoleBase(String base)
Sets the base name for role searches. |
void |
setRoleNameAttribute(String name)
Sets the role name attribute used to retrieve user roles from the result of the role search. |
void |
setRoleSearchPattern(String pattern)
Sets the message format used to select roles for a user, with "{0}" marking the spot where the distinguished name of the user goes, and/or "{1}" marking the spot for the username of the principal. |
void |
setRoleSearchScope(int scope)
Sets the role search scope as specified by javax.naming.directory.SearchControls. |
void |
setSecurityAuthentication(String authentication)
Sets the authentication level of the connection to the directory as specified by the javax.naming.Context interface, e.g. |
void |
setSecurityCredentials(String password)
Sets the credentials for authenticating the connection to the directory. |
void |
setSecurityPrincipal(String username)
Sets the principal for authenticating the connection to the directory. |
void |
setSecurityProtocol(String protocol)
Sets the protocol of the connection to the directory, e.g. |
void |
setUserBase(String base)
Sets the base name for user searches. |
void |
setUsernamePattern(String pattern)
Sets the message format pattern used to form the distinguished name of a user with "{0}" marking the spot where the specified username goes. |
void |
setUserRoleNameAttribute(String name)
Sets the user role name attribute used to retrieve user roles from the result of of user search. |
void |
setUserSearchPattern(String pattern)
Sets the message format pattern for searching users in this realm with "{0}" marking the spot where the username goes. |
void |
setUserSearchScope(int scope)
Sets the user search scope as specified by javax.naming.directory.SearchControls. |
| 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 |
| Method Detail |
|---|
String getInitialContextFactory()
void setInitialContextFactory(String factory)
factory - the initial context factory.String getProviderURL()
void setProviderURL(String URL)
URL - the provider URL.String getSecurityPrincipal()
void setSecurityPrincipal(String username)
username - the security principal.void setSecurityCredentials(String password)
password - the security credentials.String getSecurityAuthentication()
void setSecurityAuthentication(String authentication)
javax.naming.Context interface, e.g.
"none", "simple" or a SASL mechanism like "DIGEST-MD5".
authentication - the security authentication.String getSecurityProtocol()
void setSecurityProtocol(String protocol)
protocol - the security protocol.String getReferral()
void setReferral(String instruction)
javax.naming.Context inteface, e.g. "follow", "ignore" or
"throw".
instruction - the referrals processing instruction.String getUserBase()
void setUserBase(String base)
base - the user base name.int getUserSearchScope()
void setUserSearchScope(int scope)
javax.naming.directory.SearchControls.
scope - the user search scope.String getUserSearchPattern()
void setUserSearchPattern(String pattern)
pattern - the user search pattern.String getUsernamePattern()
void setUsernamePattern(String pattern)
pattern - the username pattern.String getRoleBase()
void setRoleBase(String base)
base - the role base name.int getRoleSearchScope()
void setRoleSearchScope(int scope)
javax.naming.directory.SearchControls.
scope - the role search scope.String getRoleSearchPattern()
void setRoleSearchPattern(String pattern)
pattern - the new role search pattern.String getPasswordAttribute()
void setPasswordAttribute(String name)
name - the password attributeString getRoleNameAttribute()
void setRoleNameAttribute(String name)
name - the role name attribute.String getUserRoleNameAttribute()
void setUserRoleNameAttribute(String name)
name - the user role name attribute.String getDefaultLocaleAttribute()
void setDefaultLocaleAttribute(String name)
name - the deafult locale attribute.
Attributes getAttributes(String name)
throws NamingException
name - the name of the object.
IllegalStateException - if not started.
NamingException - if a naming exception is encountered.
List search(String name,
String filter,
int scope)
throws NamingException
javax.naming.directory.SearchControls. A list
of javax.naming.directory.SearchResult objects is returned
as the result.
name - the name of context or object.filter - the search filter.scope - the scope of the search.
IllegalStateException - if not started.
NamingException - if a naming exception is encountered.
DirContext lookup()
throws NamingException
NamingException - if a naming exception is encountered.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||