當前位置: 首頁>>代碼示例>>Java>>正文


Java AuthenticationInfo.getCredentials方法代碼示例

本文整理匯總了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);
}
 
開發者ID:fuyunwang,項目名稱:SpringBootShiro,代碼行數:10,代碼來源:CredentialMatcher.java

示例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;
}
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:9,代碼來源:PasswordMatcher.java

示例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);
    }
 
開發者ID:nebrass,項目名稱:pairing-shiro-javaee7,代碼行數:6,代碼來源:BCryptCredentialsMatcher.java

示例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;
}
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:38,代碼來源:HashedCredentialsMatcher.java

示例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();
}
 
開發者ID:xuegongzi,項目名稱:rabbitframework,代碼行數:16,代碼來源:SimpleCredentialsMatcher.java


注:本文中的org.apache.shiro.authc.AuthenticationInfo.getCredentials方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。