package cn.quantgroup.xyqb.security;

import javax.security.auth.Subject;
import java.security.Principal;

/**
 * Created by Administrator on 2021/7/1 0001.
 */
public class AuthenticationPrincipal implements Principal {

    private String name;

    public AuthenticationPrincipal(String name) {
        this.name = name;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public boolean implies(Subject subject) {
        return false;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof String) {
            return getName().equals((String) obj);
        }
        if (obj instanceof Principal)
            return getName().equals(((Principal) obj).getName());
        return false;
    }


}
