package com.nuliji.tools.shiro.inter.impl;

import com.nuliji.tools.shiro.inter.RealmAuthenticationToken;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by GaoJie on 2017/11/3.
 * 带Realm的登录
 */
public class RealmHeaderToken implements RealmAuthenticationToken, AuthenticationToken {

    private static final Logger logger = LoggerFactory.getLogger(RealmHeaderToken.class);
    protected Class realmCls;
    private String token;
    @Override
    public Class getRealm() {
        return realmCls;
    }

    public RealmHeaderToken(String token, Class realmCls){
        this.token = token;
        this.realmCls = realmCls;
    }

    @Override
    public Object getPrincipal() {
        return this.token;
    }

    @Override
    public Object getCredentials() {
        return this.token;
    }
}
