MyRetryLimitCredentialsMatcher.java 1003 Bytes
package com.glsx.usercenter.shiro;

import com.glsx.usercenter.constants.LoginType;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhanghj
 * @version 1.0.0
 * @Title MyRetryLimitCredentialsMatcher.java
 * @Package com.glsx.usercenter.shiro
 * @Description TODO 密码凭证管理器
 * @date 2019年4月25日 上午10:43:04
 */
@Configuration
public class MyRetryLimitCredentialsMatcher extends HashedCredentialsMatcher {
    @Override
    public boolean doCredentialsMatch(AuthenticationToken authcToken, AuthenticationInfo info) {
        CustomToken tk = (CustomToken) authcToken;
        if (tk.getType().equals(LoginType.NOPASSWD)) {
            return true;
        }
        boolean matches = super.doCredentialsMatch(authcToken, info);
        return matches;
    }
}