Example usage for org.springframework.security.ldap.authentication LdapAuthenticationProvider setMessageSource

List of usage examples for org.springframework.security.ldap.authentication LdapAuthenticationProvider setMessageSource

Introduction

In this page you can find the example usage for org.springframework.security.ldap.authentication LdapAuthenticationProvider setMessageSource.

Prototype

public void setMessageSource(MessageSource messageSource) 

Source Link

Usage

From source file:org.artifactory.security.ldap.ArtifactoryLdapAuthenticationProvider.java

/**
 * Get the LDAP authentication providers, by iterating over all the bind authenticators and putting them in a map of
 * the settings key./*w w  w  . j  ava  2 s.c  o m*/
 *
 * @return The LDAP authentication provers
 */
public Map<String, LdapAuthenticationProvider> getLdapAuthenticationProviders() {
    if (ldapAuthenticationProviders == null) {
        ldapAuthenticationProviders = new HashMap<>();
        Map<String, BindAuthenticator> authMap = authenticator.getAuthenticators();
        for (Map.Entry<String, BindAuthenticator> entry : authMap.entrySet()) {
            LdapAuthenticationProvider ldapAuthenticationProvider = new LdapAuthenticationProvider(
                    entry.getValue());
            if (messageSource != null) {
                ldapAuthenticationProvider.setMessageSource(messageSource);
            }
            ldapAuthenticationProviders.put(entry.getKey(), ldapAuthenticationProvider);
        }
    }
    return ldapAuthenticationProviders;
}

From source file:org.artifactory.security.ldap.ArtifactoryLdapAuthenticationProvider.java

@Override
public void setMessageSource(MessageSource messageSource) {
    this.messageSource = messageSource;
    if (ldapAuthenticationProviders != null) {
        for (LdapAuthenticationProvider ldapAuthenticationProvider : ldapAuthenticationProviders.values()) {
            ldapAuthenticationProvider.setMessageSource(messageSource);
        }/*from   ww w.j a v a  2 s.  com*/
    }
}