CustomToken.java 1.27 KB
package com.glsx.usercenter.shiro;

import com.glsx.usercenter.constants.LoginType;
import org.apache.shiro.authc.UsernamePasswordToken;

/**
 * @author zhanghj
 * @version 1.0.0
 * @Title CustomToken.java
 * @Package com.glsx.usercenter.shiro
 * @Description TODO 免密验证
 * @date 2019年4月25日 上午10:18:41
 */
public class CustomToken extends UsernamePasswordToken {

    /**
     *
     */
    private static final long serialVersionUID = 2923776642963464990L;

    private LoginType type;


    public CustomToken() {
        super();
    }


    public CustomToken(String username, String password, LoginType type, boolean rememberMe, String host) {
        super(username, password, rememberMe, host);
        this.type = type;
    }

    /**
     * 免密登录
     */
    public CustomToken(String username) {
        super(username, "", false, null);
        this.type = LoginType.NOPASSWD;
    }

    /**
     * 账号密码登录
     */
    public CustomToken(String username, String pwd) {
        super(username, pwd, false, null);
        this.type = LoginType.PASSWORD;
    }

    public LoginType getType() {
        return type;
    }


    public void setType(LoginType type) {
        this.type = type;
    }
}