code: private static User login(AlluxioConfiguration conf) throws UnauthenticatedException {
      AuthType authType = conf.getEnum(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.class);
      checkSecurityEnabled(authType);
      Subject subject = new Subject();
  
      try {
        // Use the class loader of User.class to construct the LoginContext. LoginContext uses this
        // class loader to dynamically instantiate login modules. This enables
        // Subject#getPrincipals to use reflection to search for User.class instances.
        LoginContext loginContext = createLoginContext(authType, subject, User.class.getClassLoader(),
            new LoginModuleConfiguration(), conf);
        loginContext.login();
      } catch (LoginException e) {
        throw new UnauthenticatedException("Failed to login: " + e.getMessage(), e);
      }
  
      LOG.debug("login subject: {}", subject);
      Set<User> userSet = subject.getPrincipals(User.class);
      if (userSet.isEmpty()) {
        throw new UnauthenticatedException("Failed to login: No Alluxio User is found.");
      }
      if (userSet.size() > 1) {
        StringBuilder msg = new StringBuilder(
            "Failed to login: More than one Alluxio Users are found:");
        for (User user : userSet) {
          msg.append(" ").append(user.toString());
        }
        throw new UnauthenticatedException(msg.toString());
      }
      return userSet.iterator().next();
    }
docs: Logs in based on the LoginModules.
  
  @return the login user