--- title: "请求缺少次要身份验证 - 如何解决此 Elasticsearch 异常" date: 2026-01-12 lastmod: 2026-01-12 description: "当 Elasticsearch 收到需要次要身份验证的请求但未提供该验证时,会出现此错误。通常是由于安全设置配置不正确或缺少凭据导致的。" tags: ["身份验证", "SAML", "安全配置", "API密钥"] summary: " 版本: 7.7-8.9 简而言之,当 Elasticsearch 收到需要次要身份验证的请求但未提供该验证时,会出现此错误。这可能是由于安全设置配置不正确或缺少凭据导致的。要解决此问题,请确保在请求中包含必要的身份验证详细信息。或者,检查您的 Elasticsearch 安全设置,确保它们正确配置为仅在必要时要求次要身份验证。如果您使用 API 密钥进行身份验证,请确保其具有必要的权限。 日志上下文 # 日志"Request is missing secondary authentication"的类名是 TransportSamlInitiateSingleSignOnAction.java。 我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入上下文的人提供参考: possiblyReplyWithSamlFailure( authenticationState; request.getSpEntityId(); request.getAssertionConsumerService(); StatusCode.REQUESTER; new ElasticsearchSecurityException("Request is missing secondary authentication"; RestStatus.FORBIDDEN); listener ); return; } buildUserFromAuthentication(secondaryAuthentication; sp; ActionListener.wrap(user -> { " --- > **版本:** 7.7-8.9 简而言之,当 Elasticsearch 收到需要次要身份验证的请求但未提供该验证时,会出现此错误。这可能是由于安全设置配置不正确或缺少凭据导致的。要解决此问题,请确保在请求中包含必要的身份验证详细信息。或者,检查您的 Elasticsearch 安全设置,确保它们正确配置为仅在必要时要求次要身份验证。如果您使用 API 密钥进行身份验证,请确保其具有必要的权限。 日志上下文 ----------- 日志"Request is missing secondary authentication"的类名是 [TransportSamlInitiateSingleSignOnAction.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入上下文的人提供参考: ```java possiblyReplyWithSamlFailure( authenticationState; request.getSpEntityId(); request.getAssertionConsumerService(); StatusCode.REQUESTER; new ElasticsearchSecurityException("Request is missing secondary authentication"; RestStatus.FORBIDDEN); listener ); return; } buildUserFromAuthentication(secondaryAuthentication; sp; ActionListener.wrap(user -> { ```