List of usage examples for org.apache.shiro.authc SimpleAccount getCredentialsSalt
public ByteSource getCredentialsSalt()
From source file:me.buom.shiro.realm.text.HmacIniRealm.java
License:Apache License
protected void beforeAssertCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { SimpleAccount account = (SimpleAccount) info; if (account != null) { // only set credentials salt on the first time!!! ByteSource credentialsSalt = (ByteSource) account.getCredentialsSalt(); if (credentialsSalt == null) { Object credentials = account.getCredentials(); credentialsSalt = ByteSource.Util.bytes(credentials); account.setCredentialsSalt(credentialsSalt); account.setCredentials(null); }/*from www. j a v a 2s . c om*/ Object oldCredentials = account.getCredentials(); Object stringToSign = hmacBuilder.buildStringToSign((HmacToken) token); account.setCredentials(stringToSign); if (log.isDebugEnabled()) { log.debug("oldCredentials: {}", oldCredentials); log.debug("curCredentials: {}", account.getCredentials()); log.debug("credentialsSalt: {}", account.getCredentialsSalt().toHex()); } } }