public class LdapUserAttributesToRolesAuthorizationGenerator extends BaseUseAttributesAuthorizationGenerator
AuthorizationGenerator
implementation that obtains user roles from an LDAP search.
Searches are performed by this component for every user details lookup:
BaseUseAttributesAuthorizationGenerator.allowMultipleResults
property may be toggled to change that behavior.connectionFactory
Constructor and Description |
---|
LdapUserAttributesToRolesAuthorizationGenerator(org.ldaptive.ConnectionFactory factory,
org.ldaptive.SearchExecutor userSearchExecutor,
boolean allowMultipleResults,
java.lang.String roleAttribute,
java.lang.String rolePrefix)
Creates a new instance with the given required parameters.
|
Modifier and Type | Method and Description |
---|---|
protected org.pac4j.core.profile.CommonProfile |
generateAuthorizationForLdapEntry(org.pac4j.core.profile.CommonProfile profile,
org.ldaptive.LdapEntry userEntry)
Generate authorization for ldap entry.
|
addProfileRoles, addProfileRolesFromAttributes, generate
public LdapUserAttributesToRolesAuthorizationGenerator(org.ldaptive.ConnectionFactory factory, org.ldaptive.SearchExecutor userSearchExecutor, boolean allowMultipleResults, java.lang.String roleAttribute, java.lang.String rolePrefix)
factory
- Source of LDAP connections for searches.userSearchExecutor
- Executes the LDAP search for user data.allowMultipleResults
- allow multiple search results in which case the first result
returned is used to construct user details, or false to indicate that
a runtime exception should be raised on multiple search results for user details.roleAttribute
- the role attributerolePrefix
- the role prefixprotected org.pac4j.core.profile.CommonProfile generateAuthorizationForLdapEntry(org.pac4j.core.profile.CommonProfile profile, org.ldaptive.LdapEntry userEntry)
BaseUseAttributesAuthorizationGenerator
generateAuthorizationForLdapEntry
in class BaseUseAttributesAuthorizationGenerator
profile
- the profileuserEntry
- the user entry