test_class.declarator: USER_ID = "test"
test_class.modifier: private static final
test_class.original_string: private static final String USER_ID = "test";
test_class.type: String
test_class.var_name: USER_ID
test_class.declarator: USER_ID_CASED = "TeSt"
test_class.modifier: private static final
test_class.original_string: private static final String USER_ID_CASED = "TeSt";
test_class.type: String
test_class.var_name: USER_ID_CASED
test_class.declarator: USER_PW = "pw"
test_class.modifier: private static final
test_class.original_string: private static final String USER_PW = "pw";
test_class.type: String
test_class.var_name: USER_PW
test_class.declarator: user
test_class.modifier: private
test_class.original_string: private User user;
test_class.type: User
test_class.var_name: user
test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java
test_class.identifier: LoginModuleImplTest
test_class.superclass: extends AbstractSecurityTest
test_case.body: @Test
      public void testUserLogin() throws Exception {
          createTestUser();
          try (ContentSession cs = login(new SimpleCredentials(USER_ID, USER_PW.toCharArray()))) {
              AuthInfo authInfo = cs.getAuthInfo();
              assertEquals(USER_ID, authInfo.getUserID());
          }
      }
test_case.class_method_signature: LoginModuleImplTest.testUserLogin()
test_case.full_signature: @Test public void testUserLogin()
test_case.identifier: testUserLogin
test_case.invocations: createTestUser login toCharArray getAuthInfo assertEquals getUserID
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUserLogin()
focal_class.declarator: log = LoggerFactory.getLogger(LoginModuleImpl.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(LoginModuleImpl.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: SUPPORTED_CREDENTIALS = new HashSet<>(3)
focal_class.modifier: protected static final
focal_class.original_string: protected static final Set<Class> SUPPORTED_CREDENTIALS = new HashSet<>(3);
focal_class.type: Set<Class>
focal_class.var_name: SUPPORTED_CREDENTIALS
focal_class.declarator: credentials
focal_class.modifier: private
focal_class.original_string: private Credentials credentials;
focal_class.type: Credentials
focal_class.var_name: credentials
focal_class.declarator: userId
focal_class.modifier: private
focal_class.original_string: private String userId;
focal_class.type: String
focal_class.var_name: userId
focal_class.declarator: principal
focal_class.modifier: private
focal_class.original_string: private Principal principal;
focal_class.type: Principal
focal_class.var_name: principal
focal_class.declarator: success
focal_class.modifier: private
focal_class.original_string: private boolean success;
focal_class.type: boolean
focal_class.var_name: success
focal_class.declarator: principals
focal_class.modifier: private
focal_class.original_string: private Set<? extends Principal> principals;
focal_class.type: Set<? extends Principal>
focal_class.var_name: principals
focal_class.declarator: authInfo
focal_class.modifier: private
focal_class.original_string: private AuthInfo authInfo;
focal_class.type: AuthInfo
focal_class.var_name: authInfo
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
focal_class.identifier: LoginModuleImpl
focal_class.class_method_signature: LoginModuleImpl.login()
focal_class.full_signature: @Override public boolean login()
focal_class.identifier: login
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean login()
focal_class.class_method_signature: LoginModuleImpl.commit()
focal_class.full_signature: @Override public boolean commit()
focal_class.identifier: commit
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean commit()
focal_class.class_method_signature: LoginModuleImpl.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: LoginModuleImpl.getSupportedCredentials()
focal_class.full_signature: @NotNull @Override protected Set<Class> getSupportedCredentials()
focal_class.identifier: getSupportedCredentials
focal_class.modifiers: @NotNull @Override protected
focal_class.parameters: ()
focal_class.return: Set<Class>
focal_class.signature: Set<Class> getSupportedCredentials()
focal_class.class_method_signature: LoginModuleImpl.clearState()
focal_class.full_signature: @Override protected void clearState()
focal_class.identifier: clearState
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clearState()
focal_class.class_method_signature: LoginModuleImpl.getLoginId(@Nullable PreAuthenticatedLogin preAuthenticatedLogin)
focal_class.full_signature: @Nullable private String getLoginId(@Nullable PreAuthenticatedLogin preAuthenticatedLogin)
focal_class.identifier: getLoginId
focal_class.modifiers: @Nullable private
focal_class.parameters: (@Nullable PreAuthenticatedLogin preAuthenticatedLogin)
focal_class.return: String
focal_class.signature: String getLoginId(@Nullable PreAuthenticatedLogin preAuthenticatedLogin)
focal_class.class_method_signature: LoginModuleImpl.getAnonymousId()
focal_class.full_signature: @Nullable private String getAnonymousId()
focal_class.identifier: getAnonymousId
focal_class.modifiers: @Nullable private
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getAnonymousId()
focal_class.class_method_signature: LoginModuleImpl.getUserAuthentication(@Nullable String loginName)
focal_class.full_signature: @Nullable private Authentication getUserAuthentication(@Nullable String loginName)
focal_class.identifier: getUserAuthentication
focal_class.modifiers: @Nullable private
focal_class.parameters: (@Nullable String loginName)
focal_class.return: Authentication
focal_class.signature: Authentication getUserAuthentication(@Nullable String loginName)
focal_class.class_method_signature: LoginModuleImpl.createAuthInfo(@NotNull Set<? extends Principal> principals)
focal_class.full_signature: private AuthInfo createAuthInfo(@NotNull Set<? extends Principal> principals)
focal_class.identifier: createAuthInfo
focal_class.modifiers: private
focal_class.parameters: (@NotNull Set<? extends Principal> principals)
focal_class.return: AuthInfo
focal_class.signature: AuthInfo createAuthInfo(@NotNull Set<? extends Principal> principals)
focal_class.superclass: extends AbstractLoginModule
focal_method.body: @Override
      public boolean login() throws LoginException {
          credentials = getCredentials();
  
          // check if we have a pre authenticated login from a previous login module
          PreAuthenticatedLogin preAuthLogin = getSharedPreAuthLogin();
          String loginName = getLoginId(preAuthLogin);
          Authentication authentication = getUserAuthentication(loginName);
          if (authentication != null) {
              if (preAuthLogin != null) {
                  success = authentication.authenticate(PreAuthenticatedLogin.PRE_AUTHENTICATED);
              } else {
                  success = authentication.authenticate(credentials);
              }
  
              if (success) {
                  log.debug("Adding Credentials to shared state.");
                  //noinspection unchecked
                  sharedState.put(SHARED_KEY_CREDENTIALS, credentials);
  
                  log.debug("Adding login name to shared state.");
                  //noinspection unchecked
                  sharedState.put(SHARED_KEY_LOGIN_NAME, loginName);
  
                  userId = authentication.getUserId();
                  if (userId == null) {
                      userId = loginName;
                  }
                  principal = authentication.getUserPrincipal();
              }
          } else {
              // ensure that we don't commit (OAK-2998, OAK-3032)
              credentials = null;
              userId = null;
          }
          return success;
      }
focal_method.class_method_signature: LoginModuleImpl.login()
focal_method.full_signature: @Override public boolean login()
focal_method.identifier: login
focal_method.invocations: getCredentials getSharedPreAuthLogin getLoginId getUserAuthentication authenticate authenticate debug put debug put getUserId getUserPrincipal
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: boolean
focal_method.signature: boolean login()