Package org.apache.shiro.realm.ldap
Interface LdapContextFactory
-
- All Known Implementing Classes:
DefaultLdapContextFactory
,JndiLdapContextFactory
public interface LdapContextFactory
Interface that encapsulates the creation ofLdapContext
objects that are used byDefaultLdapRealm
s to perform authentication attempts and query for authorization data.- Since:
- 0.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description principal, credentials)
Creates (or retrieves from a pool) anLdapContext
connection bound using the specified principal and credentials.username, password)
Deprecated.thegetLdapContext(Object, Object)
method should be used in all cases to ensure more than String principals and credentials can be used.getSystemLdapContext()
Creates (or retrieves from a pool) aLdapContext
connection bound using the system account, or anonymously if no system account is configured.
-
-
-
Method Detail
-
getSystemLdapContext
getSystemLdapContext() throws
Creates (or retrieves from a pool) aLdapContext
connection bound using the system account, or anonymously if no system account is configured.- Returns:
- a
LdapContext
bound by the system account, or bound anonymously if no system account is configured. - Throws:
- if there is an error creating the context.
-
getLdapContext
getLdapContext( username, password) throws
Deprecated.thegetLdapContext(Object, Object)
method should be used in all cases to ensure more than String principals and credentials can be used.Creates (or retrieves from a pool) aLdapContext
connection bound using the username and password specified.- Parameters:
username
- the username to use when creating the connection.password
- the password to use when creating the connection.- Returns:
- a
LdapContext
bound using the given username and password. - Throws:
- if there is an error creating the context.
-
getLdapContext
getLdapContext( principal, credentials) throws
Creates (or retrieves from a pool) anLdapContext
connection bound using the specified principal and credentials. The format of the principal and credentials are whatever is supported by the underlying LDAP implementation. The default Sun (now Oracle) implementation supports . This method was added in Shiro 1.1 to address the fact that principals and credentials can be more than justString
user DNs and passwords for connecting to LDAP. For example, the credentials can be anX.509
certificate.- 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
LdapContext
connection bound using the specified principal and credentials. - Throws:
- if unable to acquire a connection.
- Since:
- 1.1
-
-