Signed-off-by: Vít Holásek <xvh@seznam.cz>
This commit is contained in:
@@ -25,6 +25,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
|||||||
import org.springframework.security.core.context.SecurityContext;
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.core.context.SecurityContextImpl;
|
import org.springframework.security.core.context.SecurityContextImpl;
|
||||||
|
import org.springframework.security.oauth2.core.oidc.user.OidcUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link TenantAware} implementation which retrieves the ID of the tenant
|
* A {@link TenantAware} implementation which retrieves the ID of the tenant
|
||||||
@@ -75,6 +76,9 @@ public class SecurityContextTenantAware implements TenantAware {
|
|||||||
if (principal instanceof UserPrincipal) {
|
if (principal instanceof UserPrincipal) {
|
||||||
return ((UserPrincipal) principal).getUsername();
|
return ((UserPrincipal) principal).getUsername();
|
||||||
}
|
}
|
||||||
|
if (principal instanceof OidcUser) {
|
||||||
|
return ((OidcUser) principal).getPreferredUsername();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user