📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 7.2-8.9

简要来说,当Elasticsearch的安全功能无法验证访问令牌时会发生此错误,因为ID令牌缺少at_hash声明。该声明用于验证访问令牌的完整性。要解决此问题,请确保身份提供商(IdP)配置为在ID令牌中包含at_hash声明。或者,您可以通过将’op.oidc.rp.id_token.verify_at_hash’属性设置为false来禁用Elasticsearch中的at_hash声明验证。但是,这可能会增加令牌被篡改的风险。

日志上下文 #

日志"Failed to verify access token. ID Token doesn’t contain at_hash claim"类名是 OpenIdConnectAuthenticator.java.我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解的人参考:

);
 }
 String atHashValue = idToken.getJWTClaimsSet().getStringClaim("at_hash");
 if (Strings.hasText(atHashValue) == false) {
 if (isValidationOptional == false) {
 throw new ElasticsearchSecurityException("Failed to verify access token. ID Token doesn't contain at_hash claim ");
 }
 } else {
 AccessTokenHash atHash = new AccessTokenHash(atHashValue);
 JWSAlgorithm jwsAlgorithm = JWSAlgorithm.parse(idToken.getHeader().getAlgorithm().getName());
 AccessTokenValidator.validate(accessToken; jwsAlgorithm; atHash);