Example usage for org.springframework.security.core.authority.mapping SimpleAuthorityMapper setPrefix

List of usage examples for org.springframework.security.core.authority.mapping SimpleAuthorityMapper setPrefix

Introduction

In this page you can find the example usage for org.springframework.security.core.authority.mapping SimpleAuthorityMapper setPrefix.

Prototype

public void setPrefix(String prefix) 

Source Link

Document

Sets the prefix which should be added to the authority name (if it doesn't already exist)

Usage

From source file:io.gravitee.management.idp.ldap.authentication.LdapAuthenticationProviderConfigurer.java

private LdapAuthenticationProvider build() throws Exception {
    BaseLdapPathContextSource contextSource = getContextSource();
    LdapAuthenticator ldapAuthenticator = createLdapAuthenticator(contextSource);

    LdapAuthoritiesPopulator authoritiesPopulator = getLdapAuthoritiesPopulator();

    LdapAuthenticationProvider ldapAuthenticationProvider = new LdapAuthenticationProviderProxy(
            ldapAuthenticator, authoritiesPopulator);
    SimpleAuthorityMapper simpleAuthorityMapper = new SimpleAuthorityMapper();
    simpleAuthorityMapper.setPrefix(rolePrefix);
    simpleAuthorityMapper.afterPropertiesSet();
    ldapAuthenticationProvider.setAuthoritiesMapper(simpleAuthorityMapper);
    if (userDetailsContextMapper != null) {
        ldapAuthenticationProvider.setUserDetailsContextMapper(userDetailsContextMapper);
    }/*  w  w  w.j  a  v a  2 s .  c o m*/
    return ldapAuthenticationProvider;
}