Class SpringSecurityContext
java.lang.Object
com.sap.cloud.security.xsuaa.token.SpringSecurityContext
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Cleans up the Spring Security ContextSecurityContextHolderand release thread locals for Garbage Collector to avoid memory leaks resources.static TokengetToken()Obtain the Token object from the Spring Security ContextSecurityContextHolderstatic voidinit(String encodedJwtToken, org.springframework.security.oauth2.jwt.JwtDecoder xsuaaJwtDecoder, AuthoritiesExtractor authoritiesExtractor) Initializes the Spring Security ContextSecurityContextHolderand extracts the authorities.
-
Method Details
-
getToken
Obtain the Token object from the Spring Security ContextSecurityContextHolder- Returns:
- Token object
- Throws:
org.springframework.security.access.AccessDeniedException- in case there is no token, user is not authenticatedNote: This method is introduced with xsuaa spring client lib.
-
init
public static void init(String encodedJwtToken, org.springframework.security.oauth2.jwt.JwtDecoder xsuaaJwtDecoder, AuthoritiesExtractor authoritiesExtractor) Initializes the Spring Security ContextSecurityContextHolderand extracts the authorities. With version 1.5.0 you can configure your ownAuthoritiesExtractorto specify how to extract the authorities.- Parameters:
encodedJwtToken- the jwt token that is decoded with the given JwtDecoderxsuaaJwtDecoder- the decoder of typeXsuaaJwtDecoderauthoritiesExtractor- the extractor used to turn Jwt scopes into Spring Security authorities.
-
clear
public static void clear()Cleans up the Spring Security ContextSecurityContextHolderand release thread locals for Garbage Collector to avoid memory leaks resources.
-