Interface LdapContextFactory
- All Known Implementing Classes:
JndiLdapContextFactory
public interface LdapContextFactory
Interface that encapsulates the creation of
LdapContext objects that are used by DefaultLdapRealms to
perform authentication attempts and query for authorization data.- Since:
- 0.2
-
Method Summary
Modifier and TypeMethodDescriptiongetLdapContext(Object principal, Object credentials) Creates (or retrieves from a pool) anLdapContextconnection bound using the specified principal and credentials.Creates (or retrieves from a pool) aLdapContextconnection bound using the system account, or anonymously if no system account is configured.
-
Method Details
-
getSystemLdapContext
Creates (or retrieves from a pool) aLdapContextconnection bound using the system account, or anonymously if no system account is configured.- Returns:
- a
LdapContextbound by the system account, or bound anonymously if no system account is configured. - Throws:
NamingException- if there is an error creating the context.
-
getLdapContext
Creates (or retrieves from a pool) anLdapContextconnection bound using the specified principal and credentials. The format of the principal and credentials are whatever is supported by the underlying LDAPInitialContextFactoryimplementation. The default Sun (now Oracle) implementation supports anonymous, simple, and SASL-based mechanisms. This method was added in Shiro 1.1 to address the fact that principals and credentials can be more than justStringuser DNs and passwords for connecting to LDAP. For example, the credentials can be anX.509certificate.- Parameters:
principal- the principal to use when acquiring a connection to the LDAP directorycredentials- the credentials (password, X.509 certificate, etc.) to use when acquiring a connection to the LDAP directory- Returns:
- the acquired
LdapContextconnection bound using the specified principal and credentials. - Throws:
NamingException- if unable to acquire a connection.- Since:
- 1.1
-