Spring Framework MessageSourceAccessor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MessageSourceAccessor class.

This code example shows how to use the following methods:getMessage
    private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
    protected UserDetailsContextMapper userDetailsContextMapper = new LdapUserDetailsMapper();
 
    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
        Assert.isInstanceOf(UsernamePasswordAuthenticationToken.class, authentication,
            messages.getMessage("LdapAuthenticationProvider.onlySupports",
                "Only UsernamePasswordAuthenticationToken is supported")); 
 
        final UsernamePasswordAuthenticationToken userToken = (UsernamePasswordAuthenticationToken)authentication;
 
        String username = userToken.getName();
        String password = (String) authentication.getCredentials();
 
        if (logger.isDebugEnabled()) {
            logger.debug("Processing authentication request for user: " + username);
        } 
 
        if (!StringUtils.hasLength(username)) {
            throw new BadCredentialsException(messages.getMessage("LdapAuthenticationProvider.emptyUsername",
                    "Empty Username")); 

6
CodeRank
This code example shows how to use the following methods:
    public void setUserRegistry(UserRegistry userRegistry) {
        this.userRegistry = userRegistry;
    } 
 
    public void setMessageSource(MessageSource messageSource) {
        this.messages = new MessageSourceAccessor(messageSource);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
    public void setKey(String key) {
        this.key = key;
    } 
 
    public void setMessageSource(MessageSource messageSource) {
        this.messages = new MessageSourceAccessor(messageSource);
    } 
 
    public boolean supports(Class<?> authentication) {
        return RunAsUserToken.class.isAssignableFrom(authentication);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
    public void setKey(String key) {
        this.key = key;
    } 
 
    public void setMessageSource(MessageSource messageSource) {
        this.messages = new MessageSourceAccessor(messageSource);
    } 
 
    public boolean supports(Class<?> authentication) {
        return (RememberMeAuthenticationToken.class.isAssignableFrom(authentication));
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getMessage
        if (!user.isEnabled()) {
            throw new DisabledException(messages.getMessage("AccountStatusUserDetailsChecker.disabled", "User is disabled"), user);
        } 
 
        if (!user.isAccountNonExpired()) {
            throw new AccountExpiredException(messages.getMessage("AccountStatusUserDetailsChecker.expired",
                    "User account has expired"), user);
        } 
 
        if (!user.isCredentialsNonExpired()) {
            throw new CredentialsExpiredException(messages.getMessage("AccountStatusUserDetailsChecker.credentialsExpired",
                    "User credentials have expired"), user);
        } 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
        this.key = key;
    } 
 
    public void setMessageSource(MessageSource messageSource) {
        Assert.notNull(messageSource, "messageSource cannot be null");
        this.messages = new MessageSourceAccessor(messageSource);
    } 
 
    public boolean supports(Class<?> authentication) {
        return (AnonymousAuthenticationToken.class.isAssignableFrom(authentication));
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
    } 
 
    //~ Methods ======================================================================================================== 
 
    public static MessageSourceAccessor getAccessor() {
        return new MessageSourceAccessor(new SpringSecurityMessageSource());
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
        return userSearch;
    } 
 
    public void setMessageSource(MessageSource messageSource) {
        Assert.notNull("Message source must not be null");
        this.messages = new MessageSourceAccessor(messageSource);
    } 
 
    /** 
     * Sets the user attributes which will be retrieved from the directory. 
     * 
     * @param userAttributes 
     */ 
    public void setUserAttributes(String[] userAttributes) {
        Assert.notNull(userAttributes, "The userAttributes property cannot be set to null");
        this.userAttributes = userAttributes;
    } 
 
    /** 
     * Sets the pattern which will be used to supply a DN for the user. The pattern should be the name relative 
5
CodeRank
This code example shows how to use the following methods:getMessage
     * @return Populated authentication object 
     * @throws AuthenticationException 
     */ 
    public Authentication authenticate(final Authentication authentication) throws AuthenticationException {
        Assert.isInstanceOf(UsernamePasswordAuthenticationToken.class, authentication,
            messages.getMessage("AbstractUserDetailsAuthenticationProvider.onlySupports",
                "Only UsernamePasswordAuthenticationToken is supported")); 
         
        logger.finest("CustomLdapAuthenticationProvider: authenticate");
 
        final UsernamePasswordAuthenticationToken userToken = (UsernamePasswordAuthenticationToken) authentication;
 
        String username = userToken.getName();
        String password = (String) authentication.getCredentials();
 
        logger.fine("Processing authentication request for user: " + username);
 
        if (!StringUtils.hasLength(username)) {
            throw new BadCredentialsException(messages.getMessage("LdapAuthenticationProvider.emptyUsername",
                    "Empty Username")); 

5
CodeRank
See Code Examples for Spring Framework MessageSourceAccessor Methods: