public class SpringSecurityContext extends Object
Token or
AccessToken in context of an application using
spring-security-oauth2.
It uses the SecurityContextHolder to access Spring's
SecurityContext and can therefore used also in context of
asynchronous threads.
Use this class in case your application sets Spring's security context via
one of these libraries: | Modifier and Type | Method and Description |
|---|---|
static void |
clear()
Clears the context value from the current thread.
|
static AccessToken |
getAccessToken()
Returns the token using
SecurityContextHolder. |
static Token |
getToken()
Returns the token using
SecurityContextHolder. |
@Nullable public static Token getToken()
SecurityContextHolder.null if SecurityContext is empty or
does not contain a token of this type.@Nullable public static AccessToken getAccessToken()
SecurityContextHolder.null if SecurityContext is empty or
does not contain a token of this type.public static void clear()
Copyright © 2024. All rights reserved.