Keycloak "validate signature" 使用 G Suite SAML 失败
Keycloak "validate signature" fails with G Suite SAML
我正在使用 Keycloak 5.0.0 作为身份代理。我已将其作为 SAML 应用程序连接到 G Suite。我已将其他 SAML 应用程序连接到 G Suite,所以我知道如何操作,并且我将 G Suite 元数据 XML 导入 SAML,因此我确信 X.509 密钥是正确的,但出于某种原因,如果我select "Validate Signature" 在Keycloak中,验证失败。日志说
ERROR [org.keycloak.broker.saml.SAMLEndpoint] validation failed
WARN [org.keycloak.events] type=IDENTITY_PROVIDER_RESPONSE_ERROR, realmId=master, clientId=null, userId=null, ipAddress=10.10.2.1, error=invalid_signature
如果我在 G Suite 中关闭 "Signed Response" 或在 Keycloak 中关闭 "Want Assertions Signed" 或 "Validate Signature" 那么一切正常,但我预计这是因为 Keycloak 不会尝试验证一个这些情况下的签名(当 "Want Assertions Signed" 和 "Validate Signature" 打开但 "Signed Response" 关闭时,这当然是另一个错误)。
我该如何解决这个问题?
原来我对"Signed Response"的意思理解错了。根据 G Suite 关于设置特定支持的 SAML 应用程序的文档,但在 "Set up your own custom SAML application" 文档中找不到,"Signed Response" 并不代表我认为的意思。
When the Signed Response checkbox is unchecked, only the assertion is signed. When the Signed Response checkbox is checked, the entire response is signed.
我验证(通过更改 X.509 密钥并观察结果)未选中 "Signed Response" 且 "Want Assertions Signed" 和 "Validate Signature" 打开时,Keycloak 正在验证断言是签。这就是正确、有效和安全的配置。
我正在使用 Keycloak 5.0.0 作为身份代理。我已将其作为 SAML 应用程序连接到 G Suite。我已将其他 SAML 应用程序连接到 G Suite,所以我知道如何操作,并且我将 G Suite 元数据 XML 导入 SAML,因此我确信 X.509 密钥是正确的,但出于某种原因,如果我select "Validate Signature" 在Keycloak中,验证失败。日志说
ERROR [org.keycloak.broker.saml.SAMLEndpoint] validation failed
WARN [org.keycloak.events] type=IDENTITY_PROVIDER_RESPONSE_ERROR, realmId=master, clientId=null, userId=null, ipAddress=10.10.2.1, error=invalid_signature
如果我在 G Suite 中关闭 "Signed Response" 或在 Keycloak 中关闭 "Want Assertions Signed" 或 "Validate Signature" 那么一切正常,但我预计这是因为 Keycloak 不会尝试验证一个这些情况下的签名(当 "Want Assertions Signed" 和 "Validate Signature" 打开但 "Signed Response" 关闭时,这当然是另一个错误)。
我该如何解决这个问题?
原来我对"Signed Response"的意思理解错了。根据 G Suite 关于设置特定支持的 SAML 应用程序的文档,但在 "Set up your own custom SAML application" 文档中找不到,"Signed Response" 并不代表我认为的意思。
When the Signed Response checkbox is unchecked, only the assertion is signed. When the Signed Response checkbox is checked, the entire response is signed.
我验证(通过更改 X.509 密钥并观察结果)未选中 "Signed Response" 且 "Want Assertions Signed" 和 "Validate Signature" 打开时,Keycloak 正在验证断言是签。这就是正确、有效和安全的配置。