{"record":{"id":"7c598f8982227b0e","repo":"apereo/cas","slug":"unable-to-authenticate-credentialid","errorCode":null,"errorMessage":"Unable to authenticate <credentialId>","messagePattern":"Unable to authenticate <credentialId>","errorType":"exception","errorClass":"FailedLoginException","httpStatus":null,"severity":"error","filePath":"core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/jaas/JaasAuthenticationHandler.java","lineNumber":112,"sourceCode":"        final UsernamePasswordCredential credential,\n        @Nullable final String originalPassword) throws Throwable {\n        if (StringUtils.isNotBlank(this.kerberosKdcSystemProperty)) {\n            LOGGER.debug(\"Configured kerberos system property [{}] to [{}]\", SYS_PROP_KERB5_KDC, this.kerberosKdcSystemProperty);\n            System.setProperty(SYS_PROP_KERB5_KDC, this.kerberosKdcSystemProperty);\n        }\n        if (StringUtils.isNotBlank(this.kerberosRealmSystemProperty)) {\n            LOGGER.debug(\"Setting kerberos system property [{}] to [{}]\", SYS_PROP_KRB5_REALM, this.kerberosRealmSystemProperty);\n            System.setProperty(SYS_PROP_KRB5_REALM, this.kerberosRealmSystemProperty);\n        }\n\n        val principal = authenticateAndGetPrincipal(credential);\n        val strategy = getPasswordPolicyHandlingStrategy();\n        if (principal != null && strategy != null) {\n            LOGGER.debug(\"Attempting to examine and handle password policy via [{}]\", strategy.getClass().getSimpleName());\n            val messageList = strategy.handle(principal, getPasswordPolicyConfiguration());\n            return createHandlerResult(credential, principal, messageList);\n        }\n        throw new FailedLoginException(\"Unable to authenticate \" + credential.getId());\n    }\n\n    /**\n     * Authenticate and get principal.\n     *\n     * @param credential the credential\n     * @return the principal\n     * @throws GeneralSecurityException the general security exception\n     */\n    protected @Nullable Principal authenticateAndGetPrincipal(final UsernamePasswordCredential credential) throws Throwable {\n        val lc = getLoginContext(credential);\n        try {\n            lc.login();\n            val principals = lc.getSubject().getPrincipals();\n            LOGGER.debug(\"JAAS principals extracted from subject are [{}]\", principals);\n            if (principals != null && !principals.isEmpty()) {\n                val secPrincipal = principals.iterator().next();\n                LOGGER.debug(\"JAAS principal detected from subject login context is [{}]\", secPrincipal.getName());","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/jaas/JaasAuthenticationHandler.java#L94-L130","documentation":"The JAAS authentication handler could not produce a principal from the JAAS LoginContext for the given username/password credential: authenticateAndGetPrincipal() returned null or no password-policy strategy could be applied, so authentication definitively failed. This is the terminal failure path after JAAS login throws no resolvable outcome — the credential did not authenticate against the configured JAAS realm/login module.","triggerScenarios":"Thrown at core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/jaas/JaasAuthenticationHandler.java:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the JAAS login configuration (login.conf) and realm match a valid LoginModule","Check JAAS debug output/logs for the underlying LoginException (bad credentials, account locked, etc.)","Confirm kerberosKdcSystemProperty/kerberosRealmSystemProperty settings if Kerberos-backed","Ensure the username exists in the backing JAAS realm"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e7288fc434b4f4505b8452e1a57e8fb3111bb863","analyzedAt":"2026-09-08T15:39:16.015Z","contentChangedAt":"2026-09-08T15:39:16.015Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}