test_class.declarator: store
test_class.modifier: private
test_class.original_string: private SpringSecurityTokenStore store;
test_class.type: SpringSecurityTokenStore
test_class.var_name: store
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: principal
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private Principal principal;
test_class.type: Principal
test_class.var_name: principal
test_class.declarator: requestAuthenticator
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private RequestAuthenticator requestAuthenticator;
test_class.type: RequestAuthenticator
test_class.var_name: requestAuthenticator
test_class.declarator: keycloakSecurityContext
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private RefreshableKeycloakSecurityContext keycloakSecurityContext;
test_class.type: RefreshableKeycloakSecurityContext
test_class.var_name: keycloakSecurityContext
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.file: adapters/oidc/spring-security/src/test/java/org/keycloak/adapters/springsecurity/token/SpringSecurityTokenStoreTest.java
test_class.identifier: SpringSecurityTokenStoreTest
test_case.body: @Test
      public void testIsCached() throws Exception {
          Authentication authentication = new PreAuthenticatedAuthenticationToken("foo", "bar", Collections.singleton(new KeycloakRole("ROLE_FOO")));
          SecurityContextHolder.getContext().setAuthentication(authentication);
          assertFalse(store.isCached(requestAuthenticator));
      }
test_case.class_method_signature: SpringSecurityTokenStoreTest.testIsCached()
test_case.full_signature: @Test public void testIsCached()
test_case.identifier: testIsCached
test_case.invocations: singleton setAuthentication getContext assertFalse isCached
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testIsCached()
focal_class.declarator: logger = LoggerFactory.getLogger(SpringSecurityTokenStore.class)
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = LoggerFactory.getLogger(SpringSecurityTokenStore.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: deployment
focal_class.modifier: private final
focal_class.original_string: private final KeycloakDeployment deployment;
focal_class.type: KeycloakDeployment
focal_class.var_name: deployment
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/token/SpringSecurityTokenStore.java
focal_class.identifier: SpringSecurityTokenStore
focal_class.interfaces: implements AdapterTokenStore
focal_class.class_method_signature: SpringSecurityTokenStore.SpringSecurityTokenStore(KeycloakDeployment deployment, HttpServletRequest request)
focal_class.full_signature: public  SpringSecurityTokenStore(KeycloakDeployment deployment, HttpServletRequest request)
focal_class.identifier: SpringSecurityTokenStore
focal_class.modifiers: public
focal_class.parameters: (KeycloakDeployment deployment, HttpServletRequest request)
focal_class.signature:  SpringSecurityTokenStore(KeycloakDeployment deployment, HttpServletRequest request)
focal_class.class_method_signature: SpringSecurityTokenStore.checkCurrentToken()
focal_class.full_signature: @Override public void checkCurrentToken()
focal_class.identifier: checkCurrentToken
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void checkCurrentToken()
focal_class.class_method_signature: SpringSecurityTokenStore.isCached(RequestAuthenticator authenticator)
focal_class.full_signature: @Override public boolean isCached(RequestAuthenticator authenticator)
focal_class.identifier: isCached
focal_class.modifiers: @Override public
focal_class.parameters: (RequestAuthenticator authenticator)
focal_class.return: boolean
focal_class.signature: boolean isCached(RequestAuthenticator authenticator)
focal_class.class_method_signature: SpringSecurityTokenStore.saveAccountInfo(OidcKeycloakAccount account)
focal_class.full_signature: @Override public void saveAccountInfo(OidcKeycloakAccount account)
focal_class.identifier: saveAccountInfo
focal_class.modifiers: @Override public
focal_class.parameters: (OidcKeycloakAccount account)
focal_class.return: void
focal_class.signature: void saveAccountInfo(OidcKeycloakAccount account)
focal_class.class_method_signature: SpringSecurityTokenStore.logout()
focal_class.full_signature: @Override public void logout()
focal_class.identifier: logout
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void logout()
focal_class.class_method_signature: SpringSecurityTokenStore.refreshCallback(RefreshableKeycloakSecurityContext securityContext)
focal_class.full_signature: @Override public void refreshCallback(RefreshableKeycloakSecurityContext securityContext)
focal_class.identifier: refreshCallback
focal_class.modifiers: @Override public
focal_class.parameters: (RefreshableKeycloakSecurityContext securityContext)
focal_class.return: void
focal_class.signature: void refreshCallback(RefreshableKeycloakSecurityContext securityContext)
focal_class.class_method_signature: SpringSecurityTokenStore.saveRequest()
focal_class.full_signature: @Override public void saveRequest()
focal_class.identifier: saveRequest
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void saveRequest()
focal_class.class_method_signature: SpringSecurityTokenStore.restoreRequest()
focal_class.full_signature: @Override public boolean restoreRequest()
focal_class.identifier: restoreRequest
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean restoreRequest()
focal_method.body: @Override
      public boolean isCached(RequestAuthenticator authenticator) {
  
          logger.debug("Checking if {} is cached", authenticator);
          SecurityContext context = SecurityContextHolder.getContext();
          KeycloakAuthenticationToken token;
          KeycloakSecurityContext keycloakSecurityContext;
  
          if (context == null || context.getAuthentication() == null) {
              return false;
          }
  
          if (!KeycloakAuthenticationToken.class.isAssignableFrom(context.getAuthentication().getClass())) {
              logger.warn("Expected a KeycloakAuthenticationToken, but found {}", context.getAuthentication());
              return false;
          }
  
          logger.debug("Remote logged in already. Establishing state from security context.");
          token = (KeycloakAuthenticationToken) context.getAuthentication();
          keycloakSecurityContext = token.getAccount().getKeycloakSecurityContext();
  
          if (!deployment.getRealm().equals(keycloakSecurityContext.getRealm())) {
              logger.debug("Account from security context is from a different realm than for the request.");
              logout();
              return false;
          }
  
          if (keycloakSecurityContext.getToken().isExpired()) {
              logger.warn("Security token expired ... not returning from cache");
              return false;
          }
  
          request.setAttribute(KeycloakSecurityContext.class.getName(), keycloakSecurityContext);
  
          return true;
      }
focal_method.class_method_signature: SpringSecurityTokenStore.isCached(RequestAuthenticator authenticator)
focal_method.full_signature: @Override public boolean isCached(RequestAuthenticator authenticator)
focal_method.identifier: isCached
focal_method.invocations: debug getContext getAuthentication isAssignableFrom getClass getAuthentication warn getAuthentication debug getAuthentication getKeycloakSecurityContext getAccount equals getRealm getRealm debug logout isExpired getToken warn setAttribute getName
focal_method.modifiers: @Override public
focal_method.parameters: (RequestAuthenticator authenticator)
focal_method.return: boolean
focal_method.signature: boolean isCached(RequestAuthenticator authenticator)