@Test public void getToken() { setToken(sapIdToken, NO_SCOPES); assertThat(SpringSecurityContext.getToken()).isEqualTo(sapIdToken); }
@Nullable public static Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (Objects.nonNull(authentication) && authentication.isAuthenticated() && authentication.getDetails() instanceof OAuth2AuthenticationDetails) { OAuth2AuthenticationDetails authDetails = (OAuth2AuthenticationDetails) authentication.getDetails(); String tokenValue = authDetails.getTokenValue(); return new XsuaaTokenWithGrantedAuthorities(tokenValue, authentication.getAuthorities()); } return null; }
SpringSecurityContext { @Nullable public static Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (Objects.nonNull(authentication) && authentication.isAuthenticated() && authentication.getDetails() instanceof OAuth2AuthenticationDetails) { OAuth2AuthenticationDetails authDetails = (OAuth2AuthenticationDetails) authentication.getDetails(); String tokenValue = authDetails.getTokenValue(); return new XsuaaTokenWithGrantedAuthorities(tokenValue, authentication.getAuthorities()); } return null; } }
SpringSecurityContext { @Nullable public static Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (Objects.nonNull(authentication) && authentication.isAuthenticated() && authentication.getDetails() instanceof OAuth2AuthenticationDetails) { OAuth2AuthenticationDetails authDetails = (OAuth2AuthenticationDetails) authentication.getDetails(); String tokenValue = authDetails.getTokenValue(); return new XsuaaTokenWithGrantedAuthorities(tokenValue, authentication.getAuthorities()); } return null; } private  SpringSecurityContext(); }
SpringSecurityContext { @Nullable public static Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (Objects.nonNull(authentication) && authentication.isAuthenticated() && authentication.getDetails() instanceof OAuth2AuthenticationDetails) { OAuth2AuthenticationDetails authDetails = (OAuth2AuthenticationDetails) authentication.getDetails(); String tokenValue = authDetails.getTokenValue(); return new XsuaaTokenWithGrantedAuthorities(tokenValue, authentication.getAuthorities()); } return null; } private  SpringSecurityContext(); @Nullable static Token getToken(); @Nullable static AccessToken getAccessToken(); static void clear(); }
SpringSecurityContext { @Nullable public static Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (Objects.nonNull(authentication) && authentication.isAuthenticated() && authentication.getDetails() instanceof OAuth2AuthenticationDetails) { OAuth2AuthenticationDetails authDetails = (OAuth2AuthenticationDetails) authentication.getDetails(); String tokenValue = authDetails.getTokenValue(); return new XsuaaTokenWithGrantedAuthorities(tokenValue, authentication.getAuthorities()); } return null; } private  SpringSecurityContext(); @Nullable static Token getToken(); @Nullable static AccessToken getAccessToken(); static void clear();  }