code: public CmsUser loginUser(CmsRequestContext context, String username, String password, String remoteAddress)
      throws CmsException {
  
          CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
          CmsUser result = null;
          try {
              result = m_driverManager.loginUser(
                  dbc,
                  CmsOrganizationalUnit.removeLeadingSeparator(username),
                  password,
                  remoteAddress);
          } finally {
              dbc.clear();
          }
          return result;
      }
docs: Attempts to authenticate a user into OpenCms with the given password.<p>
  
  @param context the current request context
  @param username the name of the user to be logged in
  @param password the password of the user
  @param remoteAddress the ip address of the request
  
  @return the logged in user
  
  @throws CmsException if the login was not successful