本文整理匯總了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;
}