本文整理汇总了Java中org.apache.shiro.authc.credential.HashedCredentialsMatcher.setHashAlgorithmName方法的典型用法代码示例。如果您正苦于以下问题:Java HashedCredentialsMatcher.setHashAlgorithmName方法的具体用法?Java HashedCredentialsMatcher.setHashAlgorithmName怎么用?Java HashedCredentialsMatcher.setHashAlgorithmName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.shiro.authc.credential.HashedCredentialsMatcher
的用法示例。
在下文中一共展示了HashedCredentialsMatcher.setHashAlgorithmName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setCredentialMatcher
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //导入方法依赖的package包/类
/**
* 用户的登录的明文密码,先经过md5加密再和数据库比对
*/
@PostConstruct
public void setCredentialMatcher() {
HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher();
credentialsMatcher.setHashAlgorithmName("MD5");
credentialsMatcher.setHashIterations(1024);
setCredentialsMatcher(credentialsMatcher);
}
示例2: hashedCredentialsMatcher
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //导入方法依赖的package包/类
/**
* HashCredentialsMatcher,对密码进行编码
*/
@Bean(name = "hashCredentialsMatcher")
public HashedCredentialsMatcher hashedCredentialsMatcher(){
HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher();
credentialsMatcher.setHashAlgorithmName("MD5");
credentialsMatcher.setHashIterations(2); //散列两次
credentialsMatcher.setStoredCredentialsHexEncoded(true);
return credentialsMatcher;
}
示例3: jdbcRealm
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //导入方法依赖的package包/类
@Bean(name = "jdbcRealm")
@DependsOn("lifecycleBeanPostProcessor")
public JdbcRealm jdbcRealm() {
JdbcRealm realm = new JdbcRealm();
HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher();
credentialsMatcher.setHashAlgorithmName(Sha256Hash.ALGORITHM_NAME);
realm.setCredentialsMatcher(credentialsMatcher);
realm.setDataSource(dataSource);
realm.init();
return realm;
}
示例4: provideCredentialsMatcher
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //导入方法依赖的package包/类
/**
* When annotations activated, you'll need to hash passwords in your configured Realm (i.e.: shiro.ini file)
* @return credentialsMatcher singleton implementation for this application
*/
//@Provides
//@Singleton
public CredentialsMatcher provideCredentialsMatcher(){
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher();
matcher.setHashAlgorithmName(CREDENTIALS_MATCHER_ALGORITHM_NAME);
return matcher;
}
示例5: provideCredentialsMatcher
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //导入方法依赖的package包/类
/**
* When annotations activated, you'll need to hash passwords in your configured Realm (i.e.: shiro.ini file)
* @return credentialsMatcher singleton implementation for this application
*/
//@Provides
//@Singleton
public CredentialsMatcher provideCredentialsMatcher(){
logger.entry();
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher();
matcher.setHashAlgorithmName(CREDENTIALS_MATCHER_ALGORITHM_NAME);
logger.exit(matcher);
return matcher;
}