Beispiel #1
0
  /** 设定Password校验的Hash算法与迭代次数. */
  @PostConstruct
  public void initCredentialsMatcher() {
    HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(UserService.HASH_ALGORITHM);
    matcher.setHashIterations(UserService.HASH_INTERATIONS);

    setCredentialsMatcher(matcher);
  }
 public SecurityRealm() {
   setName("SecurityRealm"); // This name must match the name in the User
   // class's getPrincipals() method
   HashedCredentialsMatcher matcher = new HashedCredentialsMatcher();
   matcher.setHashAlgorithmName("MD5");
   this.setCredentialsMatcher(matcher);
 }
 /** 设定Password 校验的Hash算法与迭代次数. */
 @PostConstruct
 public void initCredentialsMatcher() {
   HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(AccountService.HASH_ALGORITHM);
   matcher.setHashIterations(AccountService.HASH_INTERATIONS);
   /*Sets the CrendialsMatcher used during an authentication attempt to verify submitted credentials with those stored in the system.*/
   setCredentialsMatcher(matcher);
 }
Beispiel #4
0
 /** 设定Password校验的Hash算法与迭代次数. */
 @PostConstruct
 public void initCredentialsMatcher() {
   HashedCredentialsMatcher matcher =
       new HashedCredentialsMatcher(shiroUserService.getHashAlgorithm());
   matcher.setHashIterations(shiroUserService.getHashInterations());
   setCredentialsMatcher(matcher);
 }
  @Bean(name = "realm")
  @DependsOn("lifecycleBeanPostProcessor")
  public AuthorizingRealm realm() {
    HashedCredentialsMatcher credentialsMatcher =
        new HashedCredentialsMatcher(SecurityUtils.HASH_ALGORITHM);
    credentialsMatcher.setHashIterations(SecurityUtils.HASH_INTERATIONS);

    SecurityRealm securityRealm = new SecurityRealm();
    securityRealm.setCredentialsMatcher(credentialsMatcher);
    securityRealm.setCacheManager(cacheManager());
    return securityRealm;
  }