{"record":{"id":"54cebdadc3272cef","repo":"apache/cassandra","slug":"authentication-failed","errorCode":null,"errorMessage":"Authentication failed","messagePattern":"Authentication failed","errorType":"exception","errorClass":"LoginException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/auth/CassandraLoginModule.java","lineNumber":102,"sourceCode":"     * Authenticate the user, obtaining credentials from the CallbackHandler\n     * supplied in {@code}initialize{@code}. As long as the configured\n     * {@code}IAuthenticator{@code} supports the optional\n     * {@code}legacyAuthenticate{@code} method, it can be used here.\n     *\n     * @return true in all cases since this {@code}LoginModule{@code}\n     *         should not be ignored.\n     * @exception FailedLoginException if the authentication fails.\n     * @exception LoginException if this {@code}LoginModule{@code} is unable to\n     * perform the authentication.\n     */\n    @Override\n    public boolean login() throws LoginException\n    {\n        // prompt for a user name and password\n        if (callbackHandler == null)\n        {\n            logger.info(\"No CallbackHandler available for authentication\");\n            throw new LoginException(\"Authentication failed\");\n        }\n\n        NameCallback nc = new NameCallback(\"username: \");\n        PasswordCallback pc = new PasswordCallback(\"password: \", false);\n        try\n        {\n            callbackHandler.handle(new Callback[]{nc, pc});\n            username = nc.getName();\n            char[] tmpPassword = pc.getPassword();\n            if (tmpPassword == null)\n                tmpPassword = new char[0];\n            password = new char[tmpPassword.length];\n            System.arraycopy(tmpPassword, 0, password, 0, tmpPassword.length);\n            pc.clearPassword();\n        }\n        catch (IOException | UnsupportedCallbackException e)\n        {\n            logger.info(\"Unexpected exception processing authentication callbacks\", e);","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/auth/CassandraLoginModule.java#L84-L120","documentation":"FailedLoginException raised by the JAAS login module when the configured IAuthenticator's (legacy) authenticate call rejects the supplied credentials. The credentials came from the CallbackHandler initialized in initialize(); failure means the username/password pair did not match any role in system_auth (or the authenticator itself failed).","triggerScenarios":"Thrown at src/java/org/apache/cassandra/auth/CassandraLoginModule.java:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the username and password against the role record in system_auth.roles","Confirm the role exists, can_login is true, and is not locked or expired","Check which IAuthenticator is configured and that its backing store is reachable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}