|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shiro.realm.ldap.DefaultLdapContextFactory
public class DefaultLdapContextFactory
Default implementation of LdapContextFactory that can be configured or extended to
customize the way LdapContext objects are retrieved.
This implementation of LdapContextFactory is used by the AbstractLdapRealm if a
factory is not explictly configured.
Connection pooling is enabled by default on this factory, but can be disabled using the
usePooling property.
| Field Summary | |
|---|---|
protected String |
authentication
|
protected String |
contextFactoryClassName
|
protected String |
principalSuffix
|
protected String |
referral
|
protected String |
searchBase
|
protected static String |
SUN_CONNECTION_POOLING_PROPERTY
The Sun LDAP property used to enable connection pooling. |
protected String |
systemPassword
|
protected String |
systemUsername
|
protected String |
url
|
| Constructor Summary | |
|---|---|
DefaultLdapContextFactory()
|
|
| Method Summary | |
|---|---|
LdapContext |
getLdapContext(String username,
String password)
Creates (or retrieves from a pool) a LdapContext connection bound using the username and password specified. |
LdapContext |
getSystemLdapContext()
Creates (or retrieves from a pool) a LdapContext connection bound using the system account, or anonymously if no system account is configured. |
void |
setAdditionalEnvironment(Map<String,String> additionalEnvironment)
These entries are added to the environment map before initializing the LDAP context. |
void |
setAuthentication(String authentication)
Sets the type of LDAP authentication to perform when connecting to the LDAP server. |
void |
setContextFactoryClassName(String contextFactoryClassName)
The context factory to use. |
void |
setPrincipalSuffix(String principalSuffix)
A suffix appended to the username. |
void |
setReferral(String referral)
Sets the LDAP referral property. |
void |
setSearchBase(String searchBase)
The search base for the search to perform in the LDAP server. |
void |
setSystemPassword(String systemPassword)
The system password that will be used when connecting to the LDAP server to retrieve authorization information about a user. |
void |
setSystemUsername(String systemUsername)
The system username that will be used when connecting to the LDAP server to retrieve authorization information about a user. |
void |
setUrl(String url)
The LDAP url to connect to. |
void |
setUsePooling(boolean usePooling)
Determines whether or not LdapContext pooling is enabled for connections made using the system user account. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String SUN_CONNECTION_POOLING_PROPERTY
protected String authentication
protected String principalSuffix
protected String searchBase
protected String contextFactoryClassName
protected String url
protected String referral
protected String systemUsername
protected String systemPassword
| Constructor Detail |
|---|
public DefaultLdapContextFactory()
| Method Detail |
|---|
public void setAuthentication(String authentication)
authentication - the type of LDAP authentication to perform.public void setPrincipalSuffix(String principalSuffix)
principalSuffix - the suffix.public void setSearchBase(String searchBase)
searchBase - the search base.public void setContextFactoryClassName(String contextFactoryClassName)
contextFactoryClassName - the context factory that should be used.public void setUrl(String url)
url - the LDAP url.public void setReferral(String referral)
referral - the referral property.public void setSystemUsername(String systemUsername)
systemUsername - the username to use when logging into the LDAP server for authorization.public void setSystemPassword(String systemPassword)
systemPassword - the password to use when logging into the LDAP server for authorization.public void setUsePooling(boolean usePooling)
usePooling - true to enable pooling, or false to disable it.public void setAdditionalEnvironment(Map<String,String> additionalEnvironment)
additionalEnvironment - additional environment entries to be configured on the LDAP context.
public LdapContext getSystemLdapContext()
throws NamingException
LdapContextFactory
getSystemLdapContext in interface LdapContextFactoryNamingException - if there is an error creating the context.
public LdapContext getLdapContext(String username,
String password)
throws NamingException
LdapContextFactory
getLdapContext in interface LdapContextFactoryusername - the username to use when creating the connection.password - the password to use when creating the connection.
NamingException - if there is an error creating the context.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||