本文整理匯總了Java中org.apache.shiro.authc.credential.HashedCredentialsMatcher.setStoredCredentialsHexEncoded方法的典型用法代碼示例。如果您正苦於以下問題:Java HashedCredentialsMatcher.setStoredCredentialsHexEncoded方法的具體用法?Java HashedCredentialsMatcher.setStoredCredentialsHexEncoded怎麽用?Java HashedCredentialsMatcher.setStoredCredentialsHexEncoded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.shiro.authc.credential.HashedCredentialsMatcher
的用法示例。
在下文中一共展示了HashedCredentialsMatcher.setStoredCredentialsHexEncoded方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ClothoRealm
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //導入方法依賴的package包/類
@Inject
public ClothoRealm(CredentialStore store, RolePermissionResolver roleResolver) {
super();
//XXX: up number of iterations
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(Sha256Hash.ALGORITHM_NAME);
matcher.setStoredCredentialsHexEncoded(false);
this.store = store;
setAuthenticationTokenClass(UsernamePasswordToken.class);
setCredentialsMatcher(matcher);
setRolePermissionResolver(roleResolver);
setUpRealm();
}
示例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: buildRealm
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //導入方法依賴的package包/類
public AuthorizingRealm buildRealm(UserService userService, ConfigurationService configService) {
JdbcSaltedRealm realm = new JdbcSaltedRealm(userService, configService);
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher("SHA-256");
matcher.setHashIterations(1024);
matcher.setStoredCredentialsHexEncoded(false);
realm.setCredentialsMatcher(matcher);
return realm;
}
示例4: createEnvironment
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //導入方法依賴的package包/類
@Override
protected WebEnvironment createEnvironment(ServletContext sc) {
WebEnvironment webEnvironment = super.createEnvironment(sc);
RealmSecurityManager rsm = (RealmSecurityManager) webEnvironment.getSecurityManager();
HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher(HASHING_ALGORITHM);
hashedCredentialsMatcher.setStoredCredentialsHexEncoded(true);
jpaRealm.setCredentialsMatcher(hashedCredentialsMatcher);
Collection<Realm> realms = rsm.getRealms();
realms.add(jpaRealm);
rsm.setRealms(realms);
((DefaultWebEnvironment) webEnvironment).setSecurityManager(rsm);
return webEnvironment;
}
示例5: UserRealm
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //導入方法依賴的package包/類
/**
* <p>Constructor for UserRealm.</p>
*/
public UserRealm() {
final HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher(Sha256Hash.ALGORITHM_NAME);
credentialsMatcher.setHashIterations(1024);
credentialsMatcher.setStoredCredentialsHexEncoded(false);
this.setCredentialsMatcher(credentialsMatcher);
}
示例6: PersistenceRealm
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //導入方法依賴的package包/類
/**
* Constructor adds EhCacheManager.
*/
public PersistenceRealm() {
super(
new EhCacheManager());
// set hashed credentials matcher
HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher(HASH_ALGORITHM);
credentialsMatcher.setHashIterations(HASH_ITERATIONS);
credentialsMatcher.setStoredCredentialsHexEncoded(false);
setCredentialsMatcher(credentialsMatcher);
}
示例7: afterPropertiesSet
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //導入方法依賴的package包/類
@Override
public void afterPropertiesSet() throws Exception {
HashedCredentialsMatcher cm = new HashedCredentialsMatcher(Sha256Hash.ALGORITHM_NAME);
cm.setStoredCredentialsHexEncoded(false);
cm.setHashIterations(Sha256.HASH_ITERATION);
//cm.setHashSalted(true);
this.setCredentialsMatcher(cm);
// auto-create group "admins" and user "admin".
adminsAutoCreate.run();
}
示例8: UserRealm
import org.apache.shiro.authc.credential.HashedCredentialsMatcher; //導入方法依賴的package包/類
/**
* Builds an instance of UserRealm and instantiates an HashedCredentialMatcher
*
* @return an instance of UserRealm
*/
public UserRealm() {
setName(USER_REALM_NAME);
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher("SHA-256");
matcher.setStoredCredentialsHexEncoded(false);
setCredentialsMatcher(matcher);
}