@Test(expected = AccessDeniedException.class) public void getSecurityContextRaiseAccessDeniedExceptionIfNotInitialized() { SpringSecurityContext.getToken(); }
static public Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { throw new AccessDeniedException("Access forbidden: not authenticated"); } Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof Token) { return (Token) principal; } throw new AccessDeniedException( "Access forbidden: SecurityContextHolder does not contain a principal of type 'Token' " + principal); }
SpringSecurityContext { static public Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { throw new AccessDeniedException("Access forbidden: not authenticated"); } Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof Token) { return (Token) principal; } throw new AccessDeniedException( "Access forbidden: SecurityContextHolder does not contain a principal of type 'Token' " + principal); } }
SpringSecurityContext { static public Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { throw new AccessDeniedException("Access forbidden: not authenticated"); } Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof Token) { return (Token) principal; } throw new AccessDeniedException( "Access forbidden: SecurityContextHolder does not contain a principal of type 'Token' " + principal); } private  SpringSecurityContext(); }
SpringSecurityContext { static public Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { throw new AccessDeniedException("Access forbidden: not authenticated"); } Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof Token) { return (Token) principal; } throw new AccessDeniedException( "Access forbidden: SecurityContextHolder does not contain a principal of type 'Token' " + principal); } private  SpringSecurityContext(); static Token getToken(); static void init(String encodedJwtToken, JwtDecoder xsuaaJwtDecoder,
			AuthoritiesExtractor authoritiesExtractor); static void clear(); }
SpringSecurityContext { static public Token getToken() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { throw new AccessDeniedException("Access forbidden: not authenticated"); } Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (principal instanceof Token) { return (Token) principal; } throw new AccessDeniedException( "Access forbidden: SecurityContextHolder does not contain a principal of type 'Token' " + principal); } private  SpringSecurityContext(); static Token getToken(); static void init(String encodedJwtToken, JwtDecoder xsuaaJwtDecoder,
			AuthoritiesExtractor authoritiesExtractor); static void clear();  }