org.apache.shiro.authc.credential.DefaultPasswordService Java Examples

The following examples show how to use org.apache.shiro.authc.credential.DefaultPasswordService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LegacyNexusPasswordService.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
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());
}
 
Example #2
Source File: ShiroAutoConfiguration.java    From utils with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public PasswordService passwordService() {
    DefaultPasswordService service = new DefaultPasswordService();

    DefaultHashService hashService = new DefaultHashService();
    hashService.setHashAlgorithmName(shiroProperties.getHashAlgorithmName());
    hashService.setHashIterations(shiroProperties.getHashIterations());
    service.setHashService(hashService);

    return service;
}
 
Example #3
Source File: DefaultSecurityPasswordService.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public DefaultSecurityPasswordService(@Named("legacy") final PasswordService legacyPasswordService) {
  this.passwordService = new DefaultPasswordService();
  this.legacyPasswordService = checkNotNull(legacyPasswordService);

  //Create and set a hash service according to our hashing policies
  DefaultHashService hashService = new DefaultHashService();
  hashService.setHashAlgorithmName(DEFAULT_HASH_ALGORITHM);
  hashService.setHashIterations(DEFAULT_HASH_ITERATIONS);
  hashService.setGeneratePublicSalt(true);
  this.passwordService.setHashService(hashService);
}
 
Example #4
Source File: PasswordRealmMixin.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
public PasswordRealmMixin()
{
    super();
    passwordService = new DefaultPasswordService();
    PasswordMatcher matcher = new PasswordMatcher();
    matcher.setPasswordService( passwordService );
    setCredentialsMatcher( matcher );
}
 
Example #5
Source File: RealmServiceTest.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
public MyRealmMixin()
{
    super();
    passwordService = new DefaultPasswordService();
    PasswordMatcher matcher = new PasswordMatcher();
    matcher.setPasswordService( passwordService );
    setCredentialsMatcher( matcher );
}
 
Example #6
Source File: WebRealmServiceTest.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
public MyRealmMixin()
{
    super();
    passwordService = new DefaultPasswordService();
    PasswordMatcher matcher = new PasswordMatcher();
    matcher.setPasswordService( passwordService );
    setCredentialsMatcher( matcher );
}
 
Example #7
Source File: ShiroConfiguration.java    From dpCms with Apache License 2.0 4 votes vote down vote up
@Bean(name = "passwordService")
public DefaultPasswordService passwordService() {
    return new DefaultPasswordService();
}
 
Example #8
Source File: SecurityProducer.java    From shiro-jwt with MIT License 4 votes vote down vote up
@Produces
@ShiroIni
@Named
public PasswordService passwordService() {
    return new DefaultPasswordService();
}
 
Example #9
Source File: ShiroConfiguration.java    From spring-boot-shiro-orientdb with Apache License 2.0 4 votes vote down vote up
@Bean(name = "passwordService")
public DefaultPasswordService passwordService() {
    return new DefaultPasswordService();
}