private def authenticateUser()

in server/src/main/scala/org/apache/livy/server/auth/LdapAuthenticationHandlerImpl.scala [116:143]


  private def authenticateUser(userName: String, password: String): AuthenticationToken = {
    if (userName == null || userName.isEmpty) {
      throw new AuthenticationException(
        "Error validating LDAP user: a null or blank username has been provided")
    }
    if (password == null || password.isEmpty) {
      throw new AuthenticationException(
        "Error validating LDAP user: a null or blank password has been provided")
    }

    var principle = userName
    if (!LdapUtils.hasDomain(userName) && ldapDomain != null) {
      principle = userName + "@" + ldapDomain
    }
    val bindDN = if (baseDN != null) {
      "uid=" + principle + "," + baseDN
    } else {
      principle
    }

    if (enableStartTls) {
      authenticateWithTlsExtension(bindDN, password)
    } else {
      authenticateWithoutTlsExtension(bindDN, password)
    }

    new AuthenticationToken(userName, userName, "ldap")
  }