Codota Logo
org.springframework.security.crypto.password
Code IndexAdd Codota to your IDE (free)

How to use org.springframework.security.crypto.password

Best Java code snippets using org.springframework.security.crypto.password (Showing top 20 results out of 1,314)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-security-oauth

/**
 * @param passwordEncoder the password encoder to set
 */
public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
  this.emptyPassword = passwordEncoder.encode("");
}
origin: spring-projects/spring-security

/**
 * The digest algorithm to use Supports the named
 * <a href="http://java.sun.com/j2se/1.4.2/docs/guide/security/CryptoSpec.html#AppA">
 * Message Digest Algorithms</a> in the Java environment.
 *
 * @param algorithm
 */
public MessageDigestPasswordEncoder(String algorithm) {
  this.digester = new Digester(algorithm, 1);
}
origin: spring-projects/spring-security

/**
 * Create a new Digester.
 * @param algorithm the digest algorithm; for example, "SHA-1" or "SHA-256".
 * @param iterations the number of times to apply the digest algorithm to the input
 */
public Digester(String algorithm, int iterations) {
  // eagerly validate the algorithm
  createDigest(algorithm);
  this.algorithm = algorithm;
  setIterations(iterations);
}
origin: spring-projects/spring-security

@Override
public boolean matches(CharSequence rawPassword, String prefixEncodedPassword) {
  if (rawPassword == null && prefixEncodedPassword == null) {
    return true;
  }
  String id = extractId(prefixEncodedPassword);
  PasswordEncoder delegate = this.idToPasswordEncoder.get(id);
  if (delegate == null) {
    return this.defaultPasswordEncoderForMatches
      .matches(rawPassword, prefixEncodedPassword);
  }
  String encodedPassword = extractEncodedPassword(prefixEncodedPassword);
  return delegate.matches(rawPassword, encodedPassword);
}
origin: ctripcorp/apollo

@Bean
public static NoOpPasswordEncoder passwordEncoder() {
 return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}
origin: spring-projects/spring-security

private String digest(String salt, CharSequence rawPassword) {
  if (rawPassword == null) {
    rawPassword = "";
  }
  String saltedPassword = rawPassword + salt;
  byte[] saltedPasswordBytes = Utf8.encode(saltedPassword);
  Md4 md4 = new Md4();
  md4.update(saltedPasswordBytes, 0, saltedPasswordBytes.length);
  byte[] digest = md4.digest();
  String encoded = encode(digest);
  return salt + encoded;
}
origin: spring-projects/spring-security

/**
 * Takes a previously encoded password and compares it with a rawpassword after mixing
 * in the salt and encoding that value
 *
 * @param rawPassword plain text password
 * @param encodedPassword previously encoded password
 * @return true or false
 */
public boolean matches(CharSequence rawPassword, String encodedPassword) {
  String salt = extractSalt(encodedPassword);
  String rawPasswordEncoded = digest(salt, rawPassword);
  return PasswordEncoderUtils.equals(encodedPassword.toString(), rawPasswordEncoded);
}
origin: spring-projects/spring-security

/**
 * Takes a previously encoded password and compares it with a rawpassword after mixing
 * in the salt and encoding that value
 *
 * @param rawPassword plain text password
 * @param encodedPassword previously encoded password
 * @return true or false
 */
public boolean matches(CharSequence rawPassword, String encodedPassword) {
  String salt = extractSalt(encodedPassword);
  String rawPasswordEncoded = digest(salt, rawPassword);
  return PasswordEncoderUtils.equals(encodedPassword.toString(), rawPasswordEncoded);
}
origin: spring-projects/spring-security

private String digest(String salt, CharSequence rawPassword) {
  String saltedPassword = rawPassword + salt;
  byte[] digest = this.digester.digest(Utf8.encode(saltedPassword));
  String encoded = encode(digest);
  return salt + encoded;
}
origin: spring-projects/spring-security

/**
 * Sets the number of iterations for which the calculated hash value should be
 * "stretched". If this is greater than one, the initial digest is calculated, the
 * digest function will be called repeatedly on the result for the additional number
 * of iterations.
 *
 * @param iterations the number of iterations which will be executed on the hashed
 * password/salt value. Defaults to 1.
 */
public void setIterations(int iterations) {
  this.digester.setIterations(iterations);
}
origin: spring-projects/spring-security

public byte[] digest() {
  byte[] resBuf = new byte[HASH_SIZE];
  digest(resBuf, 0, HASH_SIZE);
  return resBuf;
}
origin: spring-projects/spring-security

Md4() {
  reset();
}
origin: spring-projects/spring-security

/**
 * Used to find the iteration count that takes .5 seconds.
 */
public void findDefaultIterationCount() {
  // warm up
  run(180000, 10);
  // find the default
  run(165000, 10);
}
origin: spring-projects/spring-security-oauth

  @Override
  public String encode(CharSequence rawPassword) {
    return passwordEncoder.encode(rawPassword);
  }
};
origin: sqshq/piggymetrics

@Override
public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
  oauthServer
      .tokenKeyAccess("permitAll()")
      .checkTokenAccess("isAuthenticated()")
      .passwordEncoder(NoOpPasswordEncoder.getInstance());
}
origin: org.springframework.security/spring-security-core

/**
 * Create a new Digester.
 * @param algorithm the digest algorithm; for example, "SHA-1" or "SHA-256".
 * @param iterations the number of times to apply the digest algorithm to the input
 */
public Digester(String algorithm, int iterations) {
  // eagerly validate the algorithm
  createDigest(algorithm);
  this.algorithm = algorithm;
  setIterations(iterations);
}
origin: org.springframework.security/spring-security-core

/**
 * The digest algorithm to use Supports the named
 * <a href="http://java.sun.com/j2se/1.4.2/docs/guide/security/CryptoSpec.html#AppA">
 * Message Digest Algorithms</a> in the Java environment.
 *
 * @param algorithm
 */
public MessageDigestPasswordEncoder(String algorithm) {
  this.digester = new Digester(algorithm, 1);
}
origin: org.springframework.security/spring-security-core

/**
 * Sets the number of iterations for which the calculated hash value should be
 * "stretched". If this is greater than one, the initial digest is calculated, the
 * digest function will be called repeatedly on the result for the additional number
 * of iterations.
 *
 * @param iterations the number of iterations which will be executed on the hashed
 * password/salt value. Defaults to 1.
 */
public void setIterations(int iterations) {
  this.digester.setIterations(iterations);
}
origin: spring-projects/spring-security

private void prepareTimingAttackProtection() {
  if (this.userNotFoundEncodedPassword == null) {
    this.userNotFoundEncodedPassword = this.passwordEncoder.encode(USER_NOT_FOUND_PASSWORD);
  }
}
origin: spring-projects/spring-security

@Override
public String encode(CharSequence rawPassword) {
  return PREFIX + this.idForEncode + SUFFIX + this.passwordEncoderForEncode.encode(rawPassword);
}
org.springframework.security.crypto.password

Most used classes

  • PasswordEncoder
    Service interface for encoding passwords. The preferred implementation is BCryptPasswordEncoder.
  • NoOpPasswordEncoder
    This PasswordEncoder is provided for legacy and testing purposes only and is not considered secure.
  • StandardPasswordEncoder
    This PasswordEncoder is provided for legacy purposes only and is not considered secure. A standard P
  • LdapShaPasswordEncoder
    This PasswordEncoder is provided for legacy purposes only and is not considered secure. A version of
  • Pbkdf2PasswordEncoder
    A PasswordEncoder implementation that uses PBKDF2 with a configurable number of iterations and a ran
  • Digester,
  • Md4PasswordEncoder,
  • MessageDigestPasswordEncoder,
  • PasswordEncoderUtils,
  • AbstractPasswordEncoder,
  • Md4,
  • Pbkdf2PasswordEncoder$SecretKeyFactoryAlgorithm,
  • Pbkdf2PasswordEncoderTests
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now