当前位置: 首页>>代码示例>>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;未经允许,请勿转载。