test_class.declarator: factory
test_class.modifier: @Spy
      private
test_class.original_string: @Spy
      private KeycloakSecurityContextClientRequestInterceptor factory;
test_class.type: KeycloakSecurityContextClientRequestInterceptor
test_class.var_name: factory
test_class.declarator: servletRequest
test_class.modifier: private
test_class.original_string: private MockHttpServletRequest servletRequest;
test_class.type: MockHttpServletRequest
test_class.var_name: servletRequest
test_class.declarator: keycloakSecurityContext
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private KeycloakSecurityContext keycloakSecurityContext;
test_class.type: KeycloakSecurityContext
test_class.var_name: keycloakSecurityContext
test_class.declarator: keycloakPrincipal
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private KeycloakPrincipal keycloakPrincipal;
test_class.type: KeycloakPrincipal
test_class.var_name: keycloakPrincipal
test_class.file: adapters/oidc/spring-boot2/src/test/java/org/keycloak/adapters/springboot/client/KeycloakSecurityContextClientRequestInterceptorTest.java
test_class.identifier: KeycloakSecurityContextClientRequestInterceptorTest
test_case.body: @Test(expected = IllegalStateException.class)
      public void testGetKeycloakSecurityContextNullAuthentication() throws Exception {
          servletRequest.setUserPrincipal(null);
          factory.getKeycloakSecurityContext();
      }
test_case.class_method_signature: KeycloakSecurityContextClientRequestInterceptorTest.testGetKeycloakSecurityContextNullAuthentication()
test_case.full_signature: @Test(expected = IllegalStateException.class) public void testGetKeycloakSecurityContextNullAuthentication()
test_case.identifier: testGetKeycloakSecurityContextNullAuthentication
test_case.invocations: setUserPrincipal getKeycloakSecurityContext
test_case.modifiers: @Test(expected = IllegalStateException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetKeycloakSecurityContextNullAuthentication()
focal_class.declarator: AUTHORIZATION_HEADER = "Authorization"
focal_class.modifier: private static final
focal_class.original_string: private static final String AUTHORIZATION_HEADER = "Authorization";
focal_class.type: String
focal_class.var_name: AUTHORIZATION_HEADER
focal_class.file: adapters/oidc/spring-boot2/src/main/java/org/keycloak/adapters/springboot/client/KeycloakSecurityContextClientRequestInterceptor.java
focal_class.identifier: KeycloakSecurityContextClientRequestInterceptor
focal_class.interfaces: implements ClientHttpRequestInterceptor
focal_class.class_method_signature: KeycloakSecurityContextClientRequestInterceptor.getKeycloakSecurityContext()
focal_class.full_signature: protected KeycloakSecurityContext getKeycloakSecurityContext()
focal_class.identifier: getKeycloakSecurityContext
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: KeycloakSecurityContext
focal_class.signature: KeycloakSecurityContext getKeycloakSecurityContext()
focal_class.class_method_signature: KeycloakSecurityContextClientRequestInterceptor.intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution)
focal_class.full_signature: @Override public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution)
focal_class.identifier: intercept
focal_class.modifiers: @Override public
focal_class.parameters: (HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution)
focal_class.return: ClientHttpResponse
focal_class.signature: ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution)
focal_method.body: protected KeycloakSecurityContext getKeycloakSecurityContext() {
          ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
          Principal principal = attributes.getRequest().getUserPrincipal();
          if (principal == null) {
              throw new IllegalStateException("Cannot set authorization header because there is no authenticated principal");
          }
          if (!(principal instanceof KeycloakPrincipal)) {
              throw new IllegalStateException(
                      String.format(
                              "Cannot set authorization header because the principal type %s does not provide the KeycloakSecurityContext",
                              principal.getClass()));
          }
          return ((KeycloakPrincipal) principal).getKeycloakSecurityContext();
      }
focal_method.class_method_signature: KeycloakSecurityContextClientRequestInterceptor.getKeycloakSecurityContext()
focal_method.full_signature: protected KeycloakSecurityContext getKeycloakSecurityContext()
focal_method.identifier: getKeycloakSecurityContext
focal_method.invocations: getRequestAttributes getUserPrincipal getRequest format getClass getKeycloakSecurityContext
focal_method.modifiers: protected
focal_method.parameters: ()
focal_method.return: KeycloakSecurityContext
focal_method.signature: KeycloakSecurityContext getKeycloakSecurityContext()