keycloak/keycloak

Google SAML IDP initiated login does not work

Open

#42,993 创建于 2025年9月26日

在 GitHub 查看
 (6 评论) (7 反应) (0 负责人)Java (8,346 fork)batch import
area/identity-brokeringhelp wantedkind/enhancementpriority/lowstatus/auto-bumpstatus/auto-expireteam/core-iam

仓库指标

Star
 (34,398 star)
PR 合并指标
 (平均合并 6天 19小时) (30 天内合并 384 个 PR)

描述

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

saml

Describe the bug

I setup Google as an IDP in Keycloak. Signing in works fine.

However, IDP initiated signin does not work. That one is triggered by visiting https://workspace.google.com/dashboard and clicking on Keycloak.

The error reported by Keycloak is:

SAML RelayState parameter was null when it should be returned by the IDP

Google allows setting the RelayState to a static value. However RelayState in Keycloak is made of a state, tab and clientId.

Manually setting the Relay state to ..client_id gives the error:

error="expired_code", restart_after_timeout="true"

The RelayState is parsed here: https://github.com/keycloak/keycloak/blob/main/server-spi-private/src/main/java/org/keycloak/broker/provider/util/IdentityBrokerState.java#L72

I think allowing a static RelayState would solve this problem. There is no state when the login is IDP initiated.

Version

26.3.4

Regression

  • The issue is a regression

Expected behavior

IDP-initiated signing works. Supporting a null RelayState seems the best option.

Actual behavior

An error occurs.

How to Reproduce?

  1. Setup Google as an IDP via SAML
  2. Go to https://workspace.google.com/dashboard and click on Keycloak

Anything else?

Related issues:

Related code:

贡献者指南