test_class.declarator: authenticator
test_class.modifier: private
test_class.original_string: private SpringSecurityRequestAuthenticator authenticator;
test_class.type: SpringSecurityRequestAuthenticator
test_class.var_name: authenticator
test_class.declarator: request
test_class.modifier: private
test_class.original_string: private MockHttpServletRequest request;
test_class.type: MockHttpServletRequest
test_class.var_name: request
test_class.declarator: response
test_class.modifier: private
test_class.original_string: private MockHttpServletResponse response;
test_class.type: MockHttpServletResponse
test_class.var_name: response
test_class.declarator: deployment
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private KeycloakDeployment deployment;
test_class.type: KeycloakDeployment
test_class.var_name: deployment
test_class.declarator: tokenStore
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AdapterTokenStore tokenStore;
test_class.type: AdapterTokenStore
test_class.var_name: tokenStore
test_class.declarator: principal
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal;
test_class.type: KeycloakPrincipal<RefreshableKeycloakSecurityContext>
test_class.var_name: principal
test_class.declarator: accessToken
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AccessToken accessToken;
test_class.type: AccessToken
test_class.var_name: accessToken
test_class.declarator: access
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AccessToken.Access access;
test_class.type: AccessToken.Access
test_class.var_name: access
test_class.declarator: refreshableKeycloakSecurityContext
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private RefreshableKeycloakSecurityContext refreshableKeycloakSecurityContext;
test_class.type: RefreshableKeycloakSecurityContext
test_class.var_name: refreshableKeycloakSecurityContext
test_class.file: adapters/oidc/spring-security/src/test/java/org/keycloak/adapters/springsecurity/authentication/SpringSecurityRequestAuthenticatorTest.java
test_class.identifier: SpringSecurityRequestAuthenticatorTest
test_case.body: @Test
      public void testCompleteBearerAuthentication() throws Exception {
          authenticator.completeBearerAuthentication(principal, "foo");
          verify(request).setAttribute(eq(KeycloakSecurityContext.class.getName()), eq(refreshableKeycloakSecurityContext));
          assertNotNull(SecurityContextHolder.getContext().getAuthentication());
          assertTrue(KeycloakAuthenticationToken.class.isAssignableFrom(SecurityContextHolder.getContext().getAuthentication().getClass()));
      }
test_case.class_method_signature: SpringSecurityRequestAuthenticatorTest.testCompleteBearerAuthentication()
test_case.full_signature: @Test public void testCompleteBearerAuthentication()
test_case.identifier: testCompleteBearerAuthentication
test_case.invocations: completeBearerAuthentication setAttribute verify eq getName eq assertNotNull getAuthentication getContext assertTrue isAssignableFrom getClass getAuthentication getContext
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCompleteBearerAuthentication()
focal_class.declarator: logger = LoggerFactory.getLogger(SpringSecurityRequestAuthenticator.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(SpringSecurityRequestAuthenticator.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: request
focal_class.modifier: private final
focal_class.original_string: private final HttpServletRequest request;
focal_class.type: HttpServletRequest
focal_class.var_name: request
focal_class.file: adapters/oidc/spring-security/src/main/java/org/keycloak/adapters/springsecurity/authentication/SpringSecurityRequestAuthenticator.java
focal_class.identifier: SpringSecurityRequestAuthenticator
focal_class.class_method_signature: SpringSecurityRequestAuthenticator.SpringSecurityRequestAuthenticator(
              HttpFacade facade,
              HttpServletRequest request,
              KeycloakDeployment deployment,
              AdapterTokenStore tokenStore,
              int sslRedirectPort)
focal_class.full_signature: public  SpringSecurityRequestAuthenticator(
              HttpFacade facade,
              HttpServletRequest request,
              KeycloakDeployment deployment,
              AdapterTokenStore tokenStore,
              int sslRedirectPort)
focal_class.identifier: SpringSecurityRequestAuthenticator
focal_class.modifiers: public
focal_class.parameters: (
              HttpFacade facade,
              HttpServletRequest request,
              KeycloakDeployment deployment,
              AdapterTokenStore tokenStore,
              int sslRedirectPort)
focal_class.signature:  SpringSecurityRequestAuthenticator(
              HttpFacade facade,
              HttpServletRequest request,
              KeycloakDeployment deployment,
              AdapterTokenStore tokenStore,
              int sslRedirectPort)
focal_class.class_method_signature: SpringSecurityRequestAuthenticator.createOAuthAuthenticator()
focal_class.full_signature: @Override protected OAuthRequestAuthenticator createOAuthAuthenticator()
focal_class.identifier: createOAuthAuthenticator
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: OAuthRequestAuthenticator
focal_class.signature: OAuthRequestAuthenticator createOAuthAuthenticator()
focal_class.class_method_signature: SpringSecurityRequestAuthenticator.completeOAuthAuthentication(final KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal)
focal_class.full_signature: @Override protected void completeOAuthAuthentication(final KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal)
focal_class.identifier: completeOAuthAuthentication
focal_class.modifiers: @Override protected
focal_class.parameters: (final KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal)
focal_class.return: void
focal_class.signature: void completeOAuthAuthentication(final KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal)
focal_class.class_method_signature: SpringSecurityRequestAuthenticator.completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method)
focal_class.full_signature: @Override protected void completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method)
focal_class.identifier: completeBearerAuthentication
focal_class.modifiers: @Override protected
focal_class.parameters: (KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method)
focal_class.return: void
focal_class.signature: void completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method)
focal_class.class_method_signature: SpringSecurityRequestAuthenticator.changeHttpSessionId(boolean create)
focal_class.full_signature: @Override protected String changeHttpSessionId(boolean create)
focal_class.identifier: changeHttpSessionId
focal_class.modifiers: @Override protected
focal_class.parameters: (boolean create)
focal_class.return: String
focal_class.signature: String changeHttpSessionId(boolean create)
focal_class.superclass: extends RequestAuthenticator
focal_method.body: @Override
      protected void completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method) {
  
          RefreshableKeycloakSecurityContext securityContext = principal.getKeycloakSecurityContext();
          Set<String> roles = AdapterUtils.getRolesFromSecurityContext(securityContext);
          final KeycloakAccount account = new SimpleKeycloakAccount(principal, roles, securityContext);
  
          logger.debug("Completing bearer authentication. Bearer roles: {} ",roles);
  
          SecurityContext context = SecurityContextHolder.createEmptyContext();
          context.setAuthentication(new KeycloakAuthenticationToken(account, false));
          SecurityContextHolder.setContext(context);
  
          request.setAttribute(KeycloakSecurityContext.class.getName(), securityContext);
      }
focal_method.class_method_signature: SpringSecurityRequestAuthenticator.completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method)
focal_method.full_signature: @Override protected void completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method)
focal_method.identifier: completeBearerAuthentication
focal_method.invocations: getKeycloakSecurityContext getRolesFromSecurityContext debug createEmptyContext setAuthentication setContext setAttribute getName
focal_method.modifiers: @Override protected
focal_method.parameters: (KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method)
focal_method.return: void
focal_method.signature: void completeBearerAuthentication(KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal, String method)