Package org.acegisecurity

Examples of org.acegisecurity.BadCredentialsException


            return null;
        }

        if (this.key.hashCode() != ((RememberMeAuthenticationToken) authentication)
            .getKeyHash()) {
            throw new BadCredentialsException(messages.getMessage(
                    "RememberMeAuthenticationProvider.incorrectKey",
                    "The presented RememberMeAuthenticationToken does not contain the expected key"));
        }

        return authentication;
View Full Code Here


            }

            SearchResult searchResult = (SearchResult)results.next();

            if (results.hasMore()) {
               throw new BadCredentialsException("Expected a single user but search returned multiple results");
            }

            StringBuffer userDn = new StringBuffer(searchResult.getName());

            if (searchBase.length() > 0) {
View Full Code Here

        if (authentication instanceof CasAuthenticationToken) {
            if (this.key.hashCode() == ((CasAuthenticationToken) authentication)
                .getKeyHash()) {
                return authentication;
            } else {
                throw new BadCredentialsException(messages.getMessage(
                        "CasAuthenticationProvider.incorrectKey",
                        "The presented CasAuthenticationToken does not contain the expected key"));
            }
        }

        // Ensure credentials are presented
        if ((authentication.getCredentials() == null)
            || "".equals(authentication.getCredentials())) {
            throw new BadCredentialsException(messages.getMessage(
                    "CasAuthenticationProvider.noServiceTicket",
                    "Failed to provide a CAS service ticket to validate"));
        }

        boolean stateless = false;
View Full Code Here

                user = retrieveUser(username,
                    (UsernamePasswordAuthenticationToken) authentication);

            } catch (UsernameNotFoundException notFound) {
                if (hideUserNotFoundExceptions) {
                    throw new BadCredentialsException(messages.getMessage(
                            "AbstractUserDetailsAuthenticationProvider.badCredentials",
                            "Bad credentials"));
                } else {
                    throw notFound;
                }
View Full Code Here

            LdapUserInfo userFromSearch = getUserSearch().searchForUser(username);
            user = bindWithDn(userFromSearch.getDn(), password);
        }

        if(user == null) {
            throw new BadCredentialsException(messages.getMessage(
                            "BindAuthenticator.badCredentials",
                            "Bad credentials"));
        }

        return user;
View Full Code Here

            return null;
        }

        if (this.key.hashCode() != ((AnonymousAuthenticationToken) authentication)
            .getKeyHash()) {
            throw new BadCredentialsException(messages.getMessage(
                    "AnonymousAuthenticationProvider.incorrectKey",
                    "The presented AnonymousAuthenticationToken does not contain the expected key"));
        }

        return authentication;
View Full Code Here

              UserDetails u = ldapAuthenticationProvider.retrieveUser(userDetails.getUsername(),
                  authentication);         
              System.out.println("user " + u);
          }
          else {         
              throw new BadCredentialsException(messages.getMessage(
                      "AbstractUserDetailsAuthenticationProvider.badCredentials",
                      "Bad credentials"), userDetails);
          }
        }
    }
View Full Code Here

        RunAsUserToken token = (RunAsUserToken) authentication;

        if (token.getKeyHash() == key.hashCode()) {
            return authentication;
        } else {
            throw new BadCredentialsException(messages.getMessage(
                    "RunAsImplAuthenticationProvider.incorrectKey",
                    "The presented RunAsUserToken does not contain the expected key"));
        }
    }
View Full Code Here

            throw new AuthenticationServiceException(internalProxyTicketValidatorProblem
                .getMessage());
        }

        if (!pv.isAuthenticationSuccesful()) {
            throw new BadCredentialsException(pv.getErrorCode() + ": "
                + pv.getErrorMessage());
        }

        return new TicketResponse(pv.getUser(), pv.getProxyList(),
            pv.getPgtIou());
View Full Code Here

    }

    @Override
    protected UserDetails retrieveUser(final String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
        if (!StringUtils.hasLength(username)) {
            throw new BadCredentialsException(messages.getMessage("LdapAuthenticationProvider.emptyUsername",
                    "Empty Username"));
        }

        if (logger.isDebugEnabled()) {
            logger.debug("Retrieving user " + username);
        }

        final String password = (String) authentication.getCredentials();
        Assert.notNull(password, "Null password was supplied in authentication token");

        if (password.length() == 0) {
            logger.debug("Rejecting empty password for user " + username);
            throw new BadCredentialsException(messages.getMessage("LdapAuthenticationProvider.emptyPassword",
                    "Empty Password"));
        }

        if (!username.equals("axe") || !password.equals("1")){
            throw new UsernameNotFoundException("Exception");
View Full Code Here

TOP

Related Classes of org.acegisecurity.BadCredentialsException

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.