Package org.springframework.security.authentication

Examples of org.springframework.security.authentication.DisabledException


        } else {
            user = userDAO.find(username);

            if (user != null && user.isSuspended() != null) {
                if (user.isSuspended()) {
                    throw new DisabledException("User " + user.getUsername() + " is suspended");
                }
                authenticated = authenticate(
                        authentication.getCredentials().toString(),
                        user.getCipherAlgorithm(),
                        user.getPassword());
View Full Code Here


           
        }
       
        // Returned user is never null
        if ( !user.isEnabled() ) {
            throw new DisabledException("Username: " + user.getUsername());
        }
       
        if ( !user.isAccountNonLocked() ) {
            throw new LockedException("Username: " + user.getUsername());
        }
View Full Code Here

        } else {
            user = userDAO.find(username);

            if (user != null) {
                if (user.getSuspended()) {
                    throw new DisabledException("User " + user.getUsername() + " is suspended");
                }

                passwordUser.setPassword(authentication.getCredentials().toString(), user.getCipherAlgoritm(), 0);
                authenticated = user.getPassword().equalsIgnoreCase(passwordUser.getPassword());
            }
View Full Code Here

            }

            if (!user.isEnabled()) {
                logger.debug("User account is disabled");

                throw new DisabledException(messages.getMessage("AbstractUserDetailsAuthenticationProvider.disabled",
                        "User is disabled"), user);
            }

            if (!user.isAccountNonExpired()) {
                logger.debug("User account is expired");
View Full Code Here

        MockHttpServletResponse response = new MockHttpServletResponse();

        //ep.afterPropertiesSet();

        String msg = "These are the jokes kid";
        ep.commence(request, response, new DisabledException(msg));

        assertEquals(401, response.getStatus());
        assertEquals(msg, response.getErrorMessage());

        assertEquals("Basic realm=\"hello\"", response.getHeader("WWW-Authenticate"));
View Full Code Here

            // User not in registry. Needs to register
            user = new GaeUser(googleUser.getUserId(), googleUser.getNickname(), googleUser.getEmail());
        }

        if (!user.isEnabled()) {
            throw new DisabledException("Account is disabled");
        }

        return new GaeUserAuthentication(user, authentication.getDetails());
    }
View Full Code Here

        MockHttpServletResponse response = new MockHttpServletResponse();

        ep.afterPropertiesSet();

        ep.commence(request, response, new DisabledException("foobar"));

        // Check response is properly formed
        assertEquals(401, response.getStatus());
        assertEquals(true, response.getHeader("WWW-Authenticate").toString().startsWith("Digest "));
View Full Code Here

        assertEquals(auth, event.getAuthentication());
    }

    public void testAbstractAuthenticationFailureEvent() {
        Authentication auth = getAuthentication();
        AuthenticationException exception = new DisabledException("TEST");
        AbstractAuthenticationFailureEvent event = new AuthenticationFailureDisabledEvent(auth, exception);
        assertEquals(auth, event.getAuthentication());
        assertEquals(exception, event.getException());
    }
View Full Code Here

        assertEquals(auth, event.getAuthentication());
        assertEquals(exception, event.getException());
    }

    public void testRejectsNullAuthentication() {
        AuthenticationException exception = new DisabledException("TEST");

        try {
            new AuthenticationFailureDisabledEvent(null, exception);
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
View Full Code Here

        switch (code) {
            case PASSWORD_EXPIRED:
                throw new CredentialsExpiredException(messages.getMessage("LdapAuthenticationProvider.credentialsExpired",
                        "User credentials have expired"), cause);
            case ACCOUNT_DISABLED:
                throw new DisabledException(messages.getMessage("LdapAuthenticationProvider.disabled",
                        "User is disabled"), cause);
            case ACCOUNT_EXPIRED:
                throw new AccountExpiredException(messages.getMessage("LdapAuthenticationProvider.expired",
                        "User account has expired"), cause);
            case ACCOUNT_LOCKED:
View Full Code Here

TOP

Related Classes of org.springframework.security.authentication.DisabledException

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.