我在我的身份验证中添加了额外的参数,即纪律(足球,Voleyball)。
帐户是两个不同的(未连接)但Oauth2响应具有相同的访问权限和刷新令牌。我试图调试它并注意到对象是正确的(具有不同的规则值)但可能仅通过用户名进行验证。
这是我正确转换的userDetails类,并从已实现的UserDetailsService中的方法loadUserByUsername返回具有正确规则的用户。
public class UserLoggedDetails implements Serializable, UserDetails {
public UserLoggedDetails() {
}
private static final long serialVersionUID = -1517854890490461015L;
@Transient
private List<GrantedAuthority> auths;
public void setPassword(String password) {
this.password = password;
}
private String password;
public void setUsername(String username) {
this.username = username;
}
private String username;
private String remoteId;
private Discipline discipline;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return this.auths;
}
public void setAuths(List<GrantedAuthority> auths) {
this.auths = auths;
}
@Override
public String getPassword() {
return this.password;
}
@Override
public String getUsername() {
return this.username;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
public String getRemoteId() {
return remoteId;
}
public void setRemoteId(String remoteId) {
this.remoteId = remoteId;
}
public Discipline getDiscipline() {
return discipline;
}
public void setDiscipline(Discipline discipline) {
this.discipline = discipline;
}
}