test_class.file: oak-security-spi/src/test/java/org/apache/jackrabbit/oak/spi/security/authentication/AbstractLoginModuleTest.java
test_class.identifier: AbstractLoginModuleTest
test_case.body: @Test
      public void testGetCredentialsIOException() {
          LoginModuleMonitor monitor = mock(LoginModuleMonitor.class);
          AbstractLoginModule lm = initLoginModule(new ThrowingCallbackHandler(true), monitor);
          assertNull(lm.getCredentials());
          verify(monitor, times(1)).loginError();
      }
test_case.class_method_signature: AbstractLoginModuleTest.testGetCredentialsIOException()
test_case.full_signature: @Test public void testGetCredentialsIOException()
test_case.identifier: testGetCredentialsIOException
test_case.invocations: mock initLoginModule assertNull getCredentials loginError verify times
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetCredentialsIOException()
focal_class.declarator: log = LoggerFactory.getLogger(AbstractLoginModule.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(AbstractLoginModule.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: SHARED_KEY_CREDENTIALS = "org.apache.jackrabbit.credentials"
focal_class.modifier: public static final
focal_class.original_string: public static final String SHARED_KEY_CREDENTIALS = "org.apache.jackrabbit.credentials";
focal_class.type: String
focal_class.var_name: SHARED_KEY_CREDENTIALS
focal_class.declarator: SHARED_KEY_LOGIN_NAME = "javax.security.auth.login.name"
focal_class.modifier: public static final
focal_class.original_string: public static final String SHARED_KEY_LOGIN_NAME = "javax.security.auth.login.name";
focal_class.type: String
focal_class.var_name: SHARED_KEY_LOGIN_NAME
focal_class.declarator: SHARED_KEY_ATTRIBUTES = "javax.security.auth.login.attributes"
focal_class.modifier: public static final
focal_class.original_string: public static final String SHARED_KEY_ATTRIBUTES = "javax.security.auth.login.attributes";
focal_class.type: String
focal_class.var_name: SHARED_KEY_ATTRIBUTES
focal_class.declarator: SHARED_KEY_PRE_AUTH_LOGIN = PreAuthenticatedLogin.class.getName()
focal_class.modifier: public static final
focal_class.original_string: public static final String SHARED_KEY_PRE_AUTH_LOGIN = PreAuthenticatedLogin.class.getName();
focal_class.type: String
focal_class.var_name: SHARED_KEY_PRE_AUTH_LOGIN
focal_class.declarator: subject
focal_class.modifier: protected
focal_class.original_string: protected Subject subject;
focal_class.type: Subject
focal_class.var_name: subject
focal_class.declarator: callbackHandler
focal_class.modifier: protected
focal_class.original_string: protected CallbackHandler callbackHandler;
focal_class.type: CallbackHandler
focal_class.var_name: callbackHandler
focal_class.declarator: sharedState
focal_class.modifier: protected
focal_class.original_string: protected Map sharedState;
focal_class.type: Map
focal_class.var_name: sharedState
focal_class.declarator: options
focal_class.modifier: protected
focal_class.original_string: protected ConfigurationParameters options;
focal_class.type: ConfigurationParameters
focal_class.var_name: options
focal_class.declarator: securityProvider
focal_class.modifier: private
focal_class.original_string: private SecurityProvider securityProvider;
focal_class.type: SecurityProvider
focal_class.var_name: securityProvider
focal_class.declarator: loginModuleMonitor
focal_class.modifier: private
focal_class.original_string: private LoginModuleMonitor loginModuleMonitor;
focal_class.type: LoginModuleMonitor
focal_class.var_name: loginModuleMonitor
focal_class.declarator: whiteboard
focal_class.modifier: private
focal_class.original_string: private Whiteboard whiteboard;
focal_class.type: Whiteboard
focal_class.var_name: whiteboard
focal_class.declarator: systemSession
focal_class.modifier: private
focal_class.original_string: private ContentSession systemSession;
focal_class.type: ContentSession
focal_class.var_name: systemSession
focal_class.declarator: root
focal_class.modifier: private
focal_class.original_string: private Root root;
focal_class.type: Root
focal_class.var_name: root
focal_class.file: oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/AbstractLoginModule.java
focal_class.identifier: AbstractLoginModule
focal_class.interfaces: implements LoginModule
focal_class.class_method_signature: AbstractLoginModule.initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options)
focal_class.full_signature: @Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options)
focal_class.identifier: initialize
focal_class.modifiers: @Override public
focal_class.parameters: (Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options)
focal_class.return: void
focal_class.signature: void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options)
focal_class.class_method_signature: AbstractLoginModule.logout()
focal_class.full_signature: @Override public boolean logout()
focal_class.identifier: logout
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean logout()
focal_class.class_method_signature: AbstractLoginModule.abort()
focal_class.full_signature: @Override public boolean abort()
focal_class.identifier: abort
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean abort()
focal_class.class_method_signature: AbstractLoginModule.clearState()
focal_class.full_signature: protected void clearState()
focal_class.identifier: clearState
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clearState()
focal_class.class_method_signature: AbstractLoginModule.closeSystemSession()
focal_class.full_signature: protected void closeSystemSession()
focal_class.identifier: closeSystemSession
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void closeSystemSession()
focal_class.class_method_signature: AbstractLoginModule.logout(@Nullable Set<Object> credentials, @Nullable Set<? extends Principal> principals)
focal_class.full_signature: protected boolean logout(@Nullable Set<Object> credentials, @Nullable Set<? extends Principal> principals)
focal_class.identifier: logout
focal_class.modifiers: protected
focal_class.parameters: (@Nullable Set<Object> credentials, @Nullable Set<? extends Principal> principals)
focal_class.return: boolean
focal_class.signature: boolean logout(@Nullable Set<Object> credentials, @Nullable Set<? extends Principal> principals)
focal_class.class_method_signature: AbstractLoginModule.destroyCredentials(@NotNull Iterable<Object> credentials)
focal_class.full_signature: private static void destroyCredentials(@NotNull Iterable<Object> credentials)
focal_class.identifier: destroyCredentials
focal_class.modifiers: private static
focal_class.parameters: (@NotNull Iterable<Object> credentials)
focal_class.return: void
focal_class.signature: void destroyCredentials(@NotNull Iterable<Object> credentials)
focal_class.class_method_signature: AbstractLoginModule.getSupportedCredentials()
focal_class.full_signature: @NotNull protected abstract Set<Class> getSupportedCredentials()
focal_class.identifier: getSupportedCredentials
focal_class.modifiers: @NotNull protected abstract
focal_class.parameters: ()
focal_class.return: Set<Class>
focal_class.signature: Set<Class> getSupportedCredentials()
focal_class.class_method_signature: AbstractLoginModule.getCredentials()
focal_class.full_signature: @Nullable protected Credentials getCredentials()
focal_class.identifier: getCredentials
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: Credentials
focal_class.signature: Credentials getCredentials()
focal_class.class_method_signature: AbstractLoginModule.getSharedCredentials()
focal_class.full_signature: @Nullable protected Credentials getSharedCredentials()
focal_class.identifier: getSharedCredentials
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: Credentials
focal_class.signature: Credentials getSharedCredentials()
focal_class.class_method_signature: AbstractLoginModule.getSharedLoginName()
focal_class.full_signature: @Nullable protected String getSharedLoginName()
focal_class.identifier: getSharedLoginName
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getSharedLoginName()
focal_class.class_method_signature: AbstractLoginModule.getSharedPreAuthLogin()
focal_class.full_signature: @Nullable protected PreAuthenticatedLogin getSharedPreAuthLogin()
focal_class.identifier: getSharedPreAuthLogin
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: PreAuthenticatedLogin
focal_class.signature: PreAuthenticatedLogin getSharedPreAuthLogin()
focal_class.class_method_signature: AbstractLoginModule.getSecurityProvider()
focal_class.full_signature: @Nullable protected SecurityProvider getSecurityProvider()
focal_class.identifier: getSecurityProvider
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: SecurityProvider
focal_class.signature: SecurityProvider getSecurityProvider()
focal_class.class_method_signature: AbstractLoginModule.getWhiteboard()
focal_class.full_signature: @Nullable protected Whiteboard getWhiteboard()
focal_class.identifier: getWhiteboard
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: Whiteboard
focal_class.signature: Whiteboard getWhiteboard()
focal_class.class_method_signature: AbstractLoginModule.getRoot()
focal_class.full_signature: @Nullable protected Root getRoot()
focal_class.identifier: getRoot
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: Root
focal_class.signature: Root getRoot()
focal_class.class_method_signature: AbstractLoginModule.getUserManager()
focal_class.full_signature: @Nullable protected UserManager getUserManager()
focal_class.identifier: getUserManager
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: UserManager
focal_class.signature: UserManager getUserManager()
focal_class.class_method_signature: AbstractLoginModule.getPrincipalProvider()
focal_class.full_signature: @Nullable protected PrincipalProvider getPrincipalProvider()
focal_class.identifier: getPrincipalProvider
focal_class.modifiers: @Nullable protected
focal_class.parameters: ()
focal_class.return: PrincipalProvider
focal_class.signature: PrincipalProvider getPrincipalProvider()
focal_class.class_method_signature: AbstractLoginModule.getPrincipals(@NotNull String userId)
focal_class.full_signature: @NotNull protected Set<? extends Principal> getPrincipals(@NotNull String userId)
focal_class.identifier: getPrincipals
focal_class.modifiers: @NotNull protected
focal_class.parameters: (@NotNull String userId)
focal_class.return: Set<? extends Principal>
focal_class.signature: Set<? extends Principal> getPrincipals(@NotNull String userId)
focal_class.class_method_signature: AbstractLoginModule.getPrincipals(@NotNull Principal userPrincipal)
focal_class.full_signature: @NotNull protected Set<? extends Principal> getPrincipals(@NotNull Principal userPrincipal)
focal_class.identifier: getPrincipals
focal_class.modifiers: @NotNull protected
focal_class.parameters: (@NotNull Principal userPrincipal)
focal_class.return: Set<? extends Principal>
focal_class.signature: Set<? extends Principal> getPrincipals(@NotNull Principal userPrincipal)
focal_class.class_method_signature: AbstractLoginModule.setAuthInfo(@NotNull AuthInfo authInfo, @NotNull Subject subject)
focal_class.full_signature: protected static void setAuthInfo(@NotNull AuthInfo authInfo, @NotNull Subject subject)
focal_class.identifier: setAuthInfo
focal_class.modifiers: protected static
focal_class.parameters: (@NotNull AuthInfo authInfo, @NotNull Subject subject)
focal_class.return: void
focal_class.signature: void setAuthInfo(@NotNull AuthInfo authInfo, @NotNull Subject subject)
focal_class.class_method_signature: AbstractLoginModule.getLoginModuleMonitor()
focal_class.full_signature: protected LoginModuleMonitor getLoginModuleMonitor()
focal_class.identifier: getLoginModuleMonitor
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: LoginModuleMonitor
focal_class.signature: LoginModuleMonitor getLoginModuleMonitor()
focal_class.class_method_signature: AbstractLoginModule.onError()
focal_class.full_signature: protected void onError()
focal_class.identifier: onError
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void onError()
focal_method.body: @Nullable
      protected Credentials getCredentials() {
          Set<Class> supported = getSupportedCredentials();
          if (callbackHandler != null) {
              log.debug("Login: retrieving Credentials using callback.");
              try {
                  CredentialsCallback callback = new CredentialsCallback();
                  callbackHandler.handle(new Callback[]{callback});
                  Credentials creds = callback.getCredentials();
                  if (creds != null && supported.contains(creds.getClass())) {
                      log.debug("Login: Credentials '{}' obtained from callback", creds);
                      return creds;
                  } else {
                      log.debug("Login: No supported credentials obtained from callback; trying shared state.");
                  }
              } catch (UnsupportedCallbackException | IOException e) {
                  onError();
                  log.error(e.getMessage(), e);
              }
          }
  
          Credentials creds = getSharedCredentials();
          if (creds != null && supported.contains(creds.getClass())) {
              log.debug("Login: Credentials obtained from shared state.");
              return creds;
          } else {
              log.debug("Login: No supported credentials found in shared state; looking for credentials in subject.");
              for (Class clz : getSupportedCredentials()) {
                  Set<Credentials> cds = subject.getPublicCredentials(clz);
                  if (!cds.isEmpty()) {
                      log.debug("Login: Credentials found in subject.");
                      return cds.iterator().next();
                  }
              }
          }
  
          log.debug("No credentials found.");
          return null;
      }
focal_method.class_method_signature: AbstractLoginModule.getCredentials()
focal_method.full_signature: @Nullable protected Credentials getCredentials()
focal_method.identifier: getCredentials
focal_method.invocations: getSupportedCredentials debug handle getCredentials contains getClass debug debug onError error getMessage getSharedCredentials contains getClass debug debug getSupportedCredentials getPublicCredentials isEmpty debug next iterator debug
focal_method.modifiers: @Nullable protected
focal_method.parameters: ()
focal_method.return: Credentials
focal_method.signature: Credentials getCredentials()