{"record":{"id":"2f3a5cf2b3139c85","repo":"apache/cassandra","slug":"unrecognized-callback","errorCode":null,"errorMessage":"Unrecognized Callback: ","messagePattern":"Unrecognized Callback: ","errorType":"exception","errorClass":"UnsupportedCallbackException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/auth/jmx/AuthenticationProxy.java","lineNumber":157,"sourceCode":"            {\n                String[] strings = (String[]) credentials;\n                if (strings[0] != null)\n                    username = strings[0].toCharArray();\n                if (strings[1] != null)\n                    password = strings[1].toCharArray();\n            }\n        }\n\n        public void handle(Callback[] callbacks) throws UnsupportedCallbackException\n        {\n            for (int i = 0; i < callbacks.length; i++)\n            {\n                if (callbacks[i] instanceof NameCallback)\n                    ((NameCallback)callbacks[i]).setName(username == null ? null : new String(username));\n                else if (callbacks[i] instanceof PasswordCallback)\n                    ((PasswordCallback)callbacks[i]).setPassword(password == null ? null : password);\n                else\n                    throw new UnsupportedCallbackException(callbacks[i], \"Unrecognized Callback: \" + callbacks[i].getClass().getName());\n            }\n        }\n    }\n}\n\n","sourceCodeStart":139,"sourceCodeEnd":163,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/auth/jmx/AuthenticationProxy.java#L139-L163","documentation":"AuthenticationProxy's callback handler answers NameCallback and PasswordCallback from the supplied username/password, but throws UnsupportedCallbackException for any other callback type the JAAS login module requests, with message 'Unrecognized Callback: <class>'.","triggerScenarios":"A JAAS login module configured for JMX authentication requires callbacks beyond name/password (e.g. TextInputCallback, ChoiceCallback, LanguageCallback), and handle() cannot supply them.","commonSituations":"Using a generic/login-module expecting interactive prompts (e.g. com.sun.security.auth.module.Krb5LoginModule or UI-based modules) instead of a simple user/password module like Cassandra's own or UnixLoginModule replacements.","solutions":["Configure a JAAS login module that only requires username/password callbacks (e.g. a Cassandra-compatible password login module).","If a custom module is required, extend the callback handler to support the additional callback types.","Remove interactive/other modules from the JAAS config used for JMX authentication."],"exampleFix":"// before (JAAS config)\nCassandraJMXAuth {\n  com.sun.security.auth.module.Krb5LoginModule required\n    useKeyTab=true;\n};\n// after (username/password module)\nCassandraJMXAuth {\n  org.apache.cassandra.auth.CassandraLoginModule required;\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    loginContext.login();\n} catch (LoginException e) {\n    Throwable cause = e;\n    while (cause != null) {\n        if (cause instanceof UnsupportedCallbackException) {\n            // login module needs callbacks beyond name/password; fix module choice\n            break;\n        }\n        cause = cause.getCause();\n    }\n}","preventionTips":["Use username/password-only JAAS modules for JMX auth.","Test the full login flow after any JAAS config change.","Avoid interactive/keberos modules unless the handler supports their callbacks."],"tags":["cassandra","jmx","jaas","callback"],"backgroundTag":"unsupported-callback","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}