Class ActiveDirectoryLdapAuthenticationProvider
java.lang.Object
com.codename1.backend.security.ldap.ActiveDirectoryLdapAuthenticationProvider
- All Implemented Interfaces:
AuthenticationProvider
public final class ActiveDirectoryLdapAuthenticationProvider
extends Object
implements AuthenticationProvider
Signs users in against Active Directory, as Spring's provider of the same
name: binds as user@domain, reads the user's entry by
userPrincipalName, and makes each group in memberOf an authority named
by the group's CN (Domain Admins, no prefix).
A refused bind is told apart by Active Directory's sub-error code: a locked
account is a LockedException, an expired password a
CredentialsExpiredException, a disabled account a DisabledException,
an expired account an AccountExpiredException; the rest is a
BadCredentialsException.
http.authenticationProvider(new ActiveDirectoryLdapAuthenticationProvider(
"corp.example", "ldaps://dc1.corp.example"));
-
Constructor Summary
ConstructorsConstructorDescriptionActiveDirectoryLdapAuthenticationProvider(String domain, String url) ActiveDirectoryLdapAuthenticationProvider(String domain, String url, String rootDn) -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(Authentication authentication) The accepted authentication, or null when this provider cannot decide and the next one should be asked.The context source, for its timeouts and TLS settings.voidsetSearchFilter(String searchFilter) The user filter;{0}isuser@domain,{1}the name as typed.voidsetSearchNestedGroups(boolean nestedGroups) Whether a user's authorities include the groups their groups are in.booleanWhether this provider checks tokens of this class.
-
Constructor Details
-
ActiveDirectoryLdapAuthenticationProvider
-
ActiveDirectoryLdapAuthenticationProvider
-
-
Method Details
-
getContextSource
The context source, for its timeouts and TLS settings. -
setSearchFilter
The user filter;{0}isuser@domain,{1}the name as typed. -
setSearchNestedGroups
public void setSearchNestedGroups(boolean nestedGroups) Whether a user's authorities include the groups their groups are in. Active Directory'smemberOflists direct groups only; with this on, one more search asks the directory for every group that contains the user through any chain (LDAP_MATCHING_RULE_IN_CHAIN). Off by default, as in Spring, since on a large forest that search is not cheap. -
authenticate
Description copied from interface:AuthenticationProviderThe accepted authentication, or null when this provider cannot decide and the next one should be asked.
Throws
AuthenticationException: when the token is refused
- Specified by:
authenticatein interfaceAuthenticationProvider
-
supports
Description copied from interface:AuthenticationProviderWhether this provider checks tokens of this class.- Specified by:
supportsin interfaceAuthenticationProvider
-