package cn.iocoder.yudao.module.system.controller.admin.dingding.vo;

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

import java.util.Collection;

/**
 * @author hanzy
 * @description
 * @date 2024年04月29日 13:10
 */

public class DingToken extends AbstractAuthenticationToken {
    public DingToken(Collection<? extends GrantedAuthority> authorities, String userId, String corpId) {
        super(authorities);
        this.userId = userId;
        this.corpId = corpId;
    }

    public DingToken(String userId, String corpId) {
        super(null);
        this.userId = userId;
        this.corpId = corpId;
    }

    public DingToken(String userId, String corpId, Object details) {
        super(null);
        this.userId = userId;
        this.corpId = corpId;
        super.setDetails(details);
    }

    private String userId;

    private String corpId;


    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getCorpId() {
        return corpId;
    }

    public void setCorpId(String corpId) {
        this.corpId = corpId;
    }

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

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


}
