SimpleAuthenticationInfo

 public SimpleAuthenticationInfo(Object principal, Object hashedCredentials, ByteSource credentialsSalt, String realmName) {
        this.principals = new SimplePrincipalCollection(principal, realmName);
        this.credentials = hashedCredentials;
        this.credentialsSalt = credentialsSalt;
    }

realm中使用这个构造方法时,第一个参数principal传入的值和subject.getPrincipal()获取的值一致。

这里传入userEntity(实体),subject.getPrincipal()得到的是userEntity(实体);

这里传入username(字符串),subject.getPrincipal()得到的是字符串。

原文地址:https://www.cnblogs.com/a-s-m/p/10692303.html