Package org.springframework.security.authentication

Examples of org.springframework.security.authentication.BadCredentialsException


      UsernamePasswordAuthenticationToken authentication)
      throws AuthenticationException {
    super.additionalAuthenticationChecks(userDetails, authentication);
    SignedUsernamePasswordAuthenticationToken signedToken = (SignedUsernamePasswordAuthenticationToken) authentication;
    if (signedToken.getRequestSignature() == null) {
      throw new BadCredentialsException(messages.getMessage(
          "SignedUsernamePasswordAuthenticationProvider"
              + "      .missingSignature",
          "Missing request signature"),
          isIncludeDetailsObject() ? userDetails : null);
    }
    // calculate expected signature
    if (!signedToken.getRequestSignature().equals(
        calculateExpectedSignature(signedToken))) {
      throw new BadCredentialsException(
          messages
              .getMessage(
                  "SignedUsernamePasswordAuthenticationProvider.badSignature",
                  "Invalid request signature"),
          isIncludeDetailsObject() ? userDetails : null);
View Full Code Here


          saltSource.getSalt(user));
      getJdbcTemplate().update(
          "UPDATE USERS SET PASSWORD = ? WHERE NAME = ?",
          newPassword, username);
    }else{
      throw new BadCredentialsException(messages.getMessage("JdbcDaoImpl.noAuthority",
                    new Object[] {username}, "User {0} has no GrantedAuthority"), username);
    }

  }
View Full Code Here

      UsernamePasswordAuthenticationToken authentication)
      throws AuthenticationException {
        Object salt = null;

        if (authentication.getCredentials() == null) {
            throw new BadCredentialsException(messages.getMessage(
                    "AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"),
                    includeDetailsObject ? userDetails : null);
        }

        String presentedPassword = authentication.getCredentials().toString();

        if (!passwordEncoder.isPasswordValid(userDetails.getPassword(), presentedPassword,null)) {
            throw new BadCredentialsException(messages.getMessage(
                    "AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"),
                    includeDetailsObject ? userDetails : null);
        }
   
  }
View Full Code Here

                    authentication,
                    "User " + authentication.getPrincipal() + " not authenticated");

            LOG.debug("User {} not authenticated", authentication.getPrincipal());

            throw new BadCredentialsException("User " + authentication.getPrincipal() + " not authenticated");
        }

        return token;
    }
View Full Code Here

        if (userDetails.getPassword() == null) {
            if(logger.isDebugEnabled())
                logger.debug("Falha na autenticação: usuário não forneceu a senha");

            throw new BadCredentialsException("Senha inválida");
        }

        if (!passwordEncoder.isPasswordValid(userDetails.getPassword(), presentedPassword, salt)) {
            if(logger.isDebugEnabled())
                logger.debug("Falha na autenticação: senha incorreta");

            throw new BadCredentialsException("Senha inválida");
        }
    }
View Full Code Here

            auditManager.audit(Category.authentication, AuthenticationSubCategory.login, Result.failure,
                    "User " + authentication.getPrincipal() + " not authenticated");

            LOG.debug("User {} not authenticated", authentication.getPrincipal());

            throw new BadCredentialsException("User " + authentication.getPrincipal() + " not authenticated");
        }

        return token;
    }
View Full Code Here

                    authentication,
                    "User " + authentication.getPrincipal() + " not authenticated");

            LOG.debug("User {} not authenticated", authentication.getPrincipal());

            throw new BadCredentialsException("User " + authentication.getPrincipal() + " not authenticated");
        }

        return token;
    }
View Full Code Here

        userAuth = new UserAuthentication(user);
      }
    }

    if (userAuth == null || user == null || user.getIdentifier() == null) {
      throw new BadCredentialsException("Bad credentials.");
    } else if (!user.isEnabled()) {
      throw new LockedException("Account is locked.");
    }
    return userAuth;
  }
View Full Code Here

        }
      }
    }

    if (userAuth == null || user == null || user.getIdentifier() == null) {
      throw new BadCredentialsException("Bad credentials.");
    } else if (!user.isEnabled()) {
      throw new LockedException("Account is locked.");
    }
    return userAuth;
  }
View Full Code Here

        }
      }
    }

    if (userAuth == null || user == null || user.getIdentifier() == null) {
      throw new BadCredentialsException("Bad credentials.");
    } else if (!user.isEnabled()) {
      throw new LockedException("Account is locked.");
    }
    return userAuth;
  }
View Full Code Here

TOP

Related Classes of org.springframework.security.authentication.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.