{"record":{"id":"ca2192bd222a9e81","repo":"SonarSource/sonarqube","slug":"callback-not-supported","errorCode":null,"errorMessage":"Callback not supported","messagePattern":"Callback not supported","errorType":"exception","errorClass":"UnsupportedCallbackException","httpStatus":null,"severity":"error","filePath":"server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/CallbackHandlerImpl.java","lineNumber":51,"sourceCode":"  private String name;\n  private String password;\n\n  public CallbackHandlerImpl(String name, String password) {\n    this.name = name;\n    this.password = password;\n  }\n\n  @Override\n  public void handle(Callback[] callbacks) throws UnsupportedCallbackException, IOException {\n    for (Callback callBack : callbacks) {\n      switch (callBack) {\n        case NameCallback nameCallback ->\n          // Handles username callback\n          nameCallback.setName(name);\n        case PasswordCallback passwordCallback ->\n          // Handles password callback\n          passwordCallback.setPassword(password.toCharArray());\n        case null, default -> throw new UnsupportedCallbackException(callBack, \"Callback not supported\");\n      }\n    }\n  }\n}\n","sourceCodeStart":33,"sourceCodeEnd":56,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/CallbackHandlerImpl.java#L33-L56","documentation":"CallbackHandlerImpl.handle throws UnsupportedCallbackException for any JAAS callback type other than NameCallback or PasswordCallback. The LDAP login module requested a callback this handler cannot answer (e.g. a TextOutputCallback or custom callback), so authentication cannot proceed with this handler implementation.","triggerScenarios":"handle(Callback[] callbacks, name, password) iterates callbacks; a switch case other than NameCallback/PasswordCallback/null reaches `case null, default -> throw new UnsupportedCallbackException(callBack, \"Callback not supported\")`.","commonSituations":"A JAAS/LDAP login module configured in the stack emits extra callbacks (e.g. language choice, text output for diagnostics, or a custom realm module) that the SonarQube LDAP CallbackHandler does not support; mixing third-party JAAS modules with the LDAP auth plugin.","solutions":["Inspect the UnsupportedCallbackException's callback class in the stack trace to identify which module requested it.","Remove or reconfigure the JAAS module emitting the unsupported callback; use only standard NameCallback/PasswordCallback-based LDAP login modules.","Update to a SonarQube version whose CallbackHandlerImpl supports the required callback types.","If the callback is informational (TextOutputCallback), add a case to handle it before the default branch."],"exampleFix":"// before\ncase null, default -> throw new UnsupportedCallbackException(callBack, \"Callback not supported\");\n// after\ncase TextOutputCallback textCallback -> LOG.info(\"LDAP module: {}\", textCallback.getMessage());\ncase null, default -> throw new UnsupportedCallbackException(callBack, \"Callback not supported\");","handlingStrategy":"try-catch","validationCode":"// Ensure the JAAS config only uses modules emitting NameCallback/PasswordCallback\nfor (Callback cb : callbacks) {\n    if (!(cb instanceof NameCallback) && !(cb instanceof PasswordCallback)) {\n        throw new IllegalStateException(\"Unsupported callback type: \" + cb.getClass().getName());\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    callbackHandler.handle(callbacks);\n} catch (UnsupportedCallbackException e) {\n    LOG.error(\"JAAS module requested unsupported callback: {}\", e.getCallback().getClass().getName());\n}","preventionTips":["Use only LDAP login modules that request NameCallback/PasswordCallback.","Read the UnsupportedCallbackException payload to identify the offending module.","Avoid mixing third-party JAAS modules with the SonarQube LDAP plugin."],"tags":["jaas","ldap","authentication","unsupported-callback"],"backgroundTag":"unsupported-operation","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}