Java 类org.apache.shiro.authc.credential.DefaultPasswordService 实例源码

项目:nexus-public    文件:LegacyNexusPasswordService.java   
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());
}
项目:lemcloud    文件:UserController.java   
@ResponseBody
@RequestMapping(value = "/reset")
@RequiresPermissions("user:reset")
//@SystemControllerLog(description="权限管理-添加用户")
public String resetPwd(int id) {
    try {
        User user = userService.find(id);
        user.setUserPass(new DefaultPasswordService().encryptPassword("123456"));
        userService.update(user);
        return "{ \"success\" : true }";
    } catch (Exception e) {
        e.printStackTrace();
        return "{ \"success\" : false, \"msg\" : \"操作失败\" }";
    }
}
项目:utils    文件:ShiroAutoConfiguration.java   
@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;
}
项目:polygene-java    文件:PasswordRealmMixin.java   
public PasswordRealmMixin()
{
    super();
    passwordService = new DefaultPasswordService();
    PasswordMatcher matcher = new PasswordMatcher();
    matcher.setPasswordService( passwordService );
    setCredentialsMatcher( matcher );
}
项目:polygene-java    文件:RealmServiceTest.java   
public MyRealmMixin()
{
    super();
    passwordService = new DefaultPasswordService();
    PasswordMatcher matcher = new PasswordMatcher();
    matcher.setPasswordService( passwordService );
    setCredentialsMatcher( matcher );
}
项目:polygene-java    文件:WebRealmServiceTest.java   
public MyRealmMixin()
{
    super();
    passwordService = new DefaultPasswordService();
    PasswordMatcher matcher = new PasswordMatcher();
    matcher.setPasswordService( passwordService );
    setCredentialsMatcher( matcher );
}
项目:nexus-public    文件:DefaultSecurityPasswordService.java   
@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);
}
项目:FinanceAnalytics    文件:ShiroSecurityComponentFactory.java   
/**
 * Creates the password service without registering it.
 * 
 * @param repo  the component repository, only used to register secondary items like lifecycle, not null
 * @return the password service, not null
 */
protected PasswordService createPasswordService(ComponentRepository repo) {
  DefaultHashService hashService = new DefaultHashService();
  hashService.setHashAlgorithmName(getHashAlgorithm());
  hashService.setHashIterations(getHashIterations());
  hashService.setGeneratePublicSalt(true);
  hashService.setPrivateSalt(new SimpleByteSource(getPrivateSalt()));
  DefaultPasswordService pwService = new DefaultPasswordService();
  pwService.setHashService(hashService);
  return pwService;
}
项目:mondo-integration    文件:UserStorage.java   
public static HashingPasswordService getPasswordService() {
    DefaultHashService hashService = new DefaultHashService();
    hashService.setHashIterations(HASH_ITERATIONS);
    hashService.setHashAlgorithmName(Sha512Hash.ALGORITHM_NAME);
    hashService.setGeneratePublicSalt(true);

    DefaultPasswordService passwordService = new DefaultPasswordService();
    passwordService.setHashService(hashService);
    return passwordService;
}
项目:mondo-hawk    文件:UserStorage.java   
public static HashingPasswordService getPasswordService() {
    DefaultHashService hashService = new DefaultHashService();
    hashService.setHashIterations(HASH_ITERATIONS);
    hashService.setHashAlgorithmName(Sha512Hash.ALGORITHM_NAME);
    hashService.setGeneratePublicSalt(true);

    DefaultPasswordService passwordService = new DefaultPasswordService();
    passwordService.setHashService(hashService);
    return passwordService;
}
项目:mondo-collab-framework    文件:UserStorage.java   
public static HashingPasswordService getPasswordService() {
    DefaultHashService hashService = new DefaultHashService();
    hashService.setHashIterations(HASH_ITERATIONS);
    hashService.setHashAlgorithmName(Sha512Hash.ALGORITHM_NAME);
    hashService.setGeneratePublicSalt(true);

    DefaultPasswordService passwordService = new DefaultPasswordService();
    passwordService.setHashService(hashService);
    return passwordService;
}
项目:shiro-jdbi-realm    文件:AbstractShiroTest.java   
protected static void setupShiro() {
    IniSecurityManagerFactory factory = new IniSecurityManagerFactory(); // ("classpath:shiro.ini");
    DefaultSecurityManager dsm = (DefaultSecurityManager) factory.getInstance();
    passwordService = (DefaultPasswordService) factory.getBeans().get("passwordService");
    passwordMatcher = (CredentialsMatcher) factory.getBeans().get("passwordMatcher");
    setSecurityManager(dsm);
}
项目:clemon    文件:UserServiceImpl.java   
@Override
public void save(User entity) {
    entity.setPassword(new DefaultPasswordService().encryptPassword(entity.getPassword()));
    super.save(entity);
}
项目:home    文件:SecurityTest.java   
@Test
public void f0() {
    DefaultPasswordService service = new DefaultPasswordService();
    System.out.println(service.encryptPassword("12sdf会计师考虑到付sdfsdf34").length());
    System.out.println(service.encryptPassword("1234"));
}
项目:stateless-shiro    文件:ShiroConfig.java   
@Bean(name = "passwordService")
public DefaultPasswordService passwordService() {
    return new DefaultPasswordService();
}
项目:lemcloud    文件:UserServiceImpl.java   
@Override
public void save(User entity) {
    entity.setPassword(new DefaultPasswordService().encryptPassword(entity.getPassword()));
    super.save(entity);
}
项目:lemcloud    文件:UserServiceImpl.java   
@Override
public void save(User entity) {
    entity.setUserPass(new DefaultPasswordService().encryptPassword(entity.getUserPass()));
    super.save(entity);
}
项目:protox-webapp-archetype    文件:CustomBinder.java   
@Override
protected void configure() {
    bind(DefaultPasswordService.class).to(PasswordService.class).in(Singleton.class);
}
项目:dpCms    文件:ShiroConfiguration.java   
@Bean(name = "passwordService")
public DefaultPasswordService passwordService() {
    return new DefaultPasswordService();
}
项目:shiro-jwt    文件:SecurityProducer.java   
@Produces
@ShiroIni
@Named
public PasswordService passwordService() {
    return new DefaultPasswordService();
}
项目:spring-boot-shiro-orientdb    文件:ShiroConfiguration.java   
@Bean(name = "passwordService")
public DefaultPasswordService passwordService() {
    return new DefaultPasswordService();
}
项目:kha    文件:SecurityModule.java   
@Provides @Singleton PasswordService providePasswordService() {
    return new DefaultPasswordService();
}
项目:MaritimeCloudPortalTestbed    文件:SHA512EncryptionService.java   
public SHA512EncryptionService() {
    passwordService = new DefaultPasswordService();
    ((DefaultHashService) passwordService.getHashService()).setHashAlgorithmName("SHA-512");
    // TODO: increase back to 500.000 iterations when out of development phase
    ((DefaultHashService) passwordService.getHashService()).setHashIterations(1000);
}
项目:org.ops4j.pax.shiro    文件:SecurityProducer.java   
@Produces
@ShiroIni
@Named
public PasswordService passwordService() {
    return new DefaultPasswordService();
}
项目:MaritimeCloudPortalTestbed    文件:MaritimeCloudIdentityRealmTest.java   
@Test
public void testSomeMethod() {
    // ApplicationServiceRegistry.identityApplicationService();

    String submittedPlaintextPassword = "secret";

    DefaultPasswordService passwordService = new DefaultPasswordService();

    ((DefaultHashService) passwordService.getHashService()).setHashAlgorithmName("SHA-512");

    String encryptedValue = passwordService.encryptPassword(submittedPlaintextPassword);

    System.out.println("" + encryptedValue);

}