Package org.springframework.security.core.userdetails

Examples of org.springframework.security.core.userdetails.UsernameNotFoundException


        publisher.publishAuthenticationFailure(new BadCredentialsException(""), a);
        publisher.publishAuthenticationFailure(new BadCredentialsException("", extraInfo), a);
        publisher.publishAuthenticationFailure(new BadCredentialsException("", cause), a);
        verify(appPublisher, times(3)).publishEvent(isA(AuthenticationFailureBadCredentialsEvent.class));
        reset(appPublisher);
        publisher.publishAuthenticationFailure(new UsernameNotFoundException(""), a);
        publisher.publishAuthenticationFailure(new UsernameNotFoundException("", extraInfo), a);
        publisher.publishAuthenticationFailure(new UsernameNotFoundException("", cause), a);
        publisher.publishAuthenticationFailure(new AccountExpiredException(""), a);
        publisher.publishAuthenticationFailure(new AccountExpiredException("", extraInfo), a);
        publisher.publishAuthenticationFailure(new AccountExpiredException("", cause), a);
        publisher.publishAuthenticationFailure(new ProviderNotFoundException(""), a);
        publisher.publishAuthenticationFailure(new DisabledException(""), a);
View Full Code Here


            return template.searchForSingleEntry(searchBase, searchFilter, new String[] {username});

        } catch (IncorrectResultSizeDataAccessException notFound) {
            if (notFound.getActualSize() == 0) {
                throw new UsernameNotFoundException("User " + username + " not found in directory.", username);
            }
            // Search should never return multiple results if properly configured, so just rethrow
            throw notFound;
        }
    }
View Full Code Here

        public UserDetails loadUserByUsername(String username) {
            if ("rod".equals(username)) {
                return new User("rod", password, true, true, true, true, ROLES_12);
            } else {
                throw new UsernameNotFoundException("Could not find: " + username);
            }
        }
View Full Code Here

    private class MockAuthenticationDaoUserrodWithSalt implements UserDetailsService {
        public UserDetails loadUserByUsername(String username) {
            if ("rod".equals(username)) {
                return new User("rod", "koala{SYSTEM_SALT_VALUE}", true, true, true, true, ROLES_12);
            } else {
                throw new UsernameNotFoundException("Could not find: " + username);
            }
        }
View Full Code Here

    private class MockAuthenticationDaoUserPeter implements UserDetailsService {
        public UserDetails loadUserByUsername(String username) {
            if ("peter".equals(username)) {
                return new User("peter", "opal", false, true, true, true, ROLES_12);
            } else {
                throw new UsernameNotFoundException("Could not find: " + username);
            }
        }
View Full Code Here

    private class MockAuthenticationDaoUserPeterAccountExpired implements UserDetailsService {
        public UserDetails loadUserByUsername(String username) {
            if ("peter".equals(username)) {
                return new User("peter", "opal", true, false, true, true, ROLES_12);
            } else {
                throw new UsernameNotFoundException("Could not find: " + username);
            }
        }
View Full Code Here

    private class MockAuthenticationDaoUserPeterAccountLocked implements UserDetailsService {
        public UserDetails loadUserByUsername(String username) {
            if ("peter".equals(username)) {
                return new User("peter", "opal", true, true, true, false, ROLES_12);
            } else {
                throw new UsernameNotFoundException("Could not find: " + username);
            }
        }
View Full Code Here

    private class MockAuthenticationDaoUserPeterCredentialsExpired implements UserDetailsService {
        public UserDetails loadUserByUsername(String username) {
            if ("peter".equals(username)) {
                return new User("peter", "opal", true, true, false, true, ROLES_12);
            } else {
                throw new UsernameNotFoundException("Could not find: " + username);
            }
        }
View Full Code Here

        if (user == null && getUserSearch() != null) {
            user = getUserSearch().searchForUser(username);
        }

        if (user == null) {
            throw new UsernameNotFoundException("User not found: " + username, username);
        }

        if (logger.isDebugEnabled()) {
            logger.debug("Performing LDAP compare of password attribute '" + passwordAttributeName + "' for user '" +
                    user.getDn() +"'");
View Full Code Here

        try {
            return SpringSecurityLdapTemplate.searchForSingleEntryInternal(ctx, searchCtls, searchRoot, searchFilter,
                new Object[]{bindPrincipal});
        } catch (IncorrectResultSizeDataAccessException incorrectResults) {
            if (incorrectResults.getActualSize() == 0) {
                UsernameNotFoundException userNameNotFoundException = new UsernameNotFoundException("User " + username + " not found in directory.", username);
                userNameNotFoundException.initCause(incorrectResults);
                throw badCredentials(userNameNotFoundException);
            }
            // Search should never return multiple results if properly configured, so just rethrow
            throw incorrectResults;
        }
View Full Code Here

TOP

Related Classes of org.springframework.security.core.userdetails.UsernameNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.