Package org.apache.shiro.crypto.hash

Examples of org.apache.shiro.crypto.hash.DefaultHashService


        configuration.refresh();
        PasswordRealmConfiguration config = configuration.get();
        String algorithm = config.hashAlgorithmName().get();
        Integer iterations = config.hashIterationsCount().get();
        if ( algorithm != null || iterations != null ) {
            DefaultHashService hashService = ( DefaultHashService ) passwordService.getHashService();
            if ( algorithm != null ) {
                hashService.setHashAlgorithmName( algorithm );
            }
            if ( iterations != null ) {
                hashService.setHashIterations( iterations );
            }
        }
    }
View Full Code Here


  DefaultPasswordService md5PasswordService;

  public LegacyNexusPasswordService() {
    //Initialize and configure sha1 password service
    this.sha1PasswordService = new DefaultPasswordService();
    DefaultHashService sha1HashService = new DefaultHashService();
    sha1HashService.setHashAlgorithmName("SHA-1");
    sha1HashService.setHashIterations(1);
    sha1HashService.setGeneratePublicSalt(false);
    this.sha1PasswordService.setHashService(sha1HashService);
    this.sha1PasswordService.setHashFormat(new HexFormat());

    //Initialize and configure md5 password service
    this.md5PasswordService = new DefaultPasswordService();
    DefaultHashService md5HashService = new DefaultHashService();
    md5HashService.setHashAlgorithmName("MD5");
    md5HashService.setHashIterations(1);
    md5HashService.setGeneratePublicSalt(false);
    this.md5PasswordService.setHashService(md5HashService);
    this.md5PasswordService.setHashFormat(new HexFormat());
  }
View Full Code Here

    this.securityConfiguration = securityConfiguration;
    this.passwordService = new DefaultPasswordService();
    this.legacyPasswordService = legacyPasswordService;

    //Create and set a hash service according to our hashing policies
    DefaultHashService hashService = new DefaultHashService();
    hashService.setHashAlgorithmName(DEFAULT_HASH_ALGORITHM);
    hashService.setHashIterations(this.securityConfiguration.getHashIterations());
    hashService.setGeneratePublicSalt(true);
    this.passwordService.setHashService(hashService);
  }
View Full Code Here

    private volatile boolean hashFormatWarned; //used to avoid excessive log noise

    public DefaultPasswordService() {
        this.hashFormatWarned = false;

        DefaultHashService hashService = new DefaultHashService();
        hashService.setHashAlgorithmName(DEFAULT_HASH_ALGORITHM);
        hashService.setHashIterations(DEFAULT_HASH_ITERATIONS);
        hashService.setGeneratePublicSalt(true); //always want generated salts for user passwords to be most secure
        this.hashService = hashService;

        this.hashFormat = new Shiro1CryptFormat();
        this.hashFormatFactory = new DefaultHashFormatFactory();
    }
View Full Code Here

TOP

Related Classes of org.apache.shiro.crypto.hash.DefaultHashService

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.