getId(Object) 추가

master
mjkhan21 9 months ago
parent dc9ba1d219
commit e56faa3cb3

@ -60,6 +60,20 @@ public class SecuredUserInfo extends UserInfo implements UserDetails {
private List<Authority> authorities;
private boolean sealed;
@Override
public String getId(Object auth) {
UserInfo userInfo = null;
if (auth instanceof Authentication) {
Object obj = ((Authentication)auth).getPrincipal();
if (obj instanceof UserInfo)
userInfo = (UserInfo)obj;
}
if (userInfo == null)
throw new RuntimeException(String.format("Unable to get a UserInfo from %s", auth));
return userInfo.getId();
}
@Override
public List<Authority> getAuthorities() {
return authorities != null ? authorities : Collections.emptyList();

Loading…
Cancel
Save