package com.skr.mdm.authentication.user.qr;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @author nfq
 * @date 2020/9/16 16:38
 */
public class UsernameAuthenticationToken extends AbstractAuthenticationToken {

    private static final long serialVersionUID = 7948283620358847230L;

    private final Object principal;
    private Object credentials;
    private final Object imei;
    private final Object oaid;
    private final Object uuid;
    private Object loginMethod;
    private final Object companyId;

    public UsernameAuthenticationToken(Object principal, Object credentials, Object imei, Object oaid, Object uuid, Object loginMethod, Object companyId) {
        super(null);
        this.principal = principal;
        this.credentials = credentials;
        this.imei = imei;
        this.oaid = oaid;
        this.uuid = uuid;
        this.loginMethod = loginMethod;
        this.companyId = companyId;
        setAuthenticated(false);
    }

    public UsernameAuthenticationToken(Collection<? extends GrantedAuthority> authorities, Object principal, Object imei, Object oaid, Object uuid, Object companyId) {
        super(authorities);
        this.principal = principal;
        this.imei = imei;
        this.oaid = oaid;
        this.uuid = uuid;
        this.companyId = companyId;
        super.setAuthenticated(true);
    }

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

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

    @Override
    public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
        super.setAuthenticated(isAuthenticated);
    }

    public Object getImei() {
        return this.imei;
    }

    public Object getLoginMethod() {
        return loginMethod;
    }

    public Object getOaid() {
        return oaid;
    }

    public Object getUuid() {
        return uuid;
    }

    public Object getCompanyId() {
        return companyId;
    }
}
