本文整理匯總了Java中org.apache.shiro.authc.AuthenticationInfo.getCredentials方法的典型用法代碼示例。如果您正苦於以下問題:Java AuthenticationInfo.getCredentials方法的具體用法?Java AuthenticationInfo.getCredentials怎麽用?Java AuthenticationInfo.getCredentials使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.shiro.authc.AuthenticationInfo
的用法示例。
在下文中一共展示了AuthenticationInfo.getCredentials方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doCredentialsMatch
import org.apache.shiro.authc.AuthenticationInfo; //導入方法依賴的package包/類
@Override
public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
UsernamePasswordToken usernamePasswordToken= (UsernamePasswordToken) token;
String password=new String(usernamePasswordToken.getPassword());
SimpleHash hash=new SimpleHash("md5",password,"1997password",3);
String dbPassword= (String) info.getCredentials();
return this.equals(hash.toString(),dbPassword);
}
示例2: getStoredPassword
import org.apache.shiro.authc.AuthenticationInfo; //導入方法依賴的package包/類
protected Object getStoredPassword(AuthenticationInfo storedAccountInfo) {
Object stored = storedAccountInfo != null ? storedAccountInfo.getCredentials() : null;
//fix for https://issues.apache.org/jira/browse/SHIRO-363
if (stored instanceof char[]) {
stored = new String((char[])stored);
}
return stored;
}
示例3: getCredentials
import org.apache.shiro.authc.AuthenticationInfo; //導入方法依賴的package包/類
private byte[] getCredentials(AuthenticationInfo info) {
return (byte[]) info.getCredentials();
}
開發者ID:geetools,項目名稱:geeCommerce-Java-Shop-Software-and-PIM,代碼行數:4,代碼來源:DefaultCredentialsMatcher.java
示例4: getCredentials
import org.apache.shiro.authc.AuthenticationInfo; //導入方法依賴的package包/類
private String getCredentials(AuthenticationInfo info) {
Object credentials = info.getCredentials();
return toString(credentials);
}
示例5: getCredentials
import org.apache.shiro.authc.AuthenticationInfo; //導入方法依賴的package包/類
/**
* Returns a {@link Hash Hash} instance representing the already-hashed AuthenticationInfo credentials stored in the system.
* <p/>
* This method reconstructs a {@link Hash Hash} instance based on a {@code info.getCredentials} call,
* but it does <em>not</em> hash that value - it is expected that method call will return an already-hashed value.
* <p/>
* This implementation's reconstruction effort functions as follows:
* <ol>
* <li>Convert {@code account.getCredentials()} to a byte array via the {@link #toBytes toBytes} method.
* <li>If {@code account.getCredentials()} was originally a String or char[] before {@code toBytes} was
* called, check for encoding:
* <li>If {@link #storedCredentialsHexEncoded storedCredentialsHexEncoded}, Hex decode that byte array, otherwise
* Base64 decode the byte array</li>
* <li>Set the byte[] array directly on the {@code Hash} implementation and return it.</li>
* </ol>
*
* @param info the AuthenticationInfo from which to retrieve the credentials which assumed to be in already-hashed form.
* @return a {@link Hash Hash} instance representing the given AuthenticationInfo's stored credentials.
*/
protected Object getCredentials(AuthenticationInfo info) {
Object credentials = info.getCredentials();
byte[] storedBytes = toBytes(credentials);
if (credentials instanceof String || credentials instanceof char[]) {
//account.credentials were a char[] or String, so
//we need to do text decoding first:
if (isStoredCredentialsHexEncoded()) {
storedBytes = Hex.decode(storedBytes);
} else {
storedBytes = Base64.decode(storedBytes);
}
}
AbstractHash hash = newHashInstance();
hash.setBytes(storedBytes);
return hash;
}
示例6: getCredentials
import org.apache.shiro.authc.AuthenticationInfo; //導入方法依賴的package包/類
/**
* Returns the {@code account}'s credentials.
* <p/>
* <p>This default implementation merely returns
* {@link AuthenticationInfo#getCredentials() account.getCredentials()} and exists as a template hook if subclasses
* wish to obtain the credentials in a different way or convert them to a different format before
* returning.
*
* @param info the {@code AuthenticationInfo} stored in the data store to be compared against the submitted authentication
* token's credentials.
* @return the {@code account}'s associated credentials.
*/
protected Object getCredentials(AuthenticationInfo info) {
return info.getCredentials();
}