{"record":{"id":"0b230f031a465971","repo":"apache/hadoop","slug":"error-validating-ldap-user-a-null-or-blank-userna","errorCode":null,"errorMessage":"Error validating LDAP user: a null or blank username has been provided","messagePattern":"Error validating LDAP user: a null or blank username has been provided","errorType":"exception","errorClass":"AuthenticationException","httpStatus":401,"severity":"error","filePath":"hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/LdapAuthenticationHandler.java","lineNumber":212,"sourceCode":"    } else {\n      authorization =\n          authorization.substring(HttpConstants.BASIC.length()).trim();\n      final Base64 base64 = new Base64(0);\n      // As per RFC7617, UTF-8 charset should be used for decoding.\n      String[] credentials = new String(base64.decode(authorization),\n          StandardCharsets.UTF_8).split(\":\", 2);\n      if (credentials.length == 2) {\n        token = authenticateUser(credentials[0], credentials[1]);\n        response.setStatus(HttpServletResponse.SC_OK);\n      }\n    }\n    return token;\n  }\n\n  private AuthenticationToken authenticateUser(String userName,\n      String password) throws AuthenticationException {\n    if (userName == null || userName.isEmpty()) {\n      throw new AuthenticationException(\"Error validating LDAP user:\"\n          + \" a null or blank username has been provided\");\n    }\n\n    // If the domain is available in the config, then append it unless domain\n    // is already part of the username. LDAP providers like Active Directory\n    // use a fully qualified user name like foo@bar.com.\n    if (!hasDomain(userName) && ldapDomain != null) {\n      userName = userName + \"@\" + ldapDomain;\n    }\n\n    if (password == null || password.isEmpty() ||\n        password.getBytes(StandardCharsets.UTF_8)[0] == 0) {\n      throw new AuthenticationException(\"Error validating LDAP user:\"\n          + \" a null or blank password has been provided\");\n    }\n\n    // setup the security principal\n    String bindDN;","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/LdapAuthenticationHandler.java#L194-L230","documentation":"Error \"Error validating LDAP user: a null or blank username has been provided\" thrown in apache/hadoop.","triggerScenarios":"Raised at runtime when the documented precondition or configuration requirement for this operation is violated.","commonSituations":"Misconfigured or missing property, invalid user input, or calling the API before its prerequisites are met.","solutions":["Provide a non-empty username in the authentication request."],"exampleFix":"Send a valid 'userName' parameter in the login request.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}