The original meaning of RelayState
is that the SP can send some value to the IDP together with the AuthnRequest
and then get it back. The SP can put whatever value it wants in the RelayState
and the IDP should just echo it back in the response.
This RelayState
parameter is meant to be an opaque identifier that is passed back without any modification or inspection
There is also another, de facto standard use for RelayState
when using Idp-initiated log on. In that case, there is no incoming request from the SP, so there can be no state to be relayed back. Instead, the RelayState
is used by the IDP to signal to the SP what URL the SP should redirect to after successful sign on. In the standard (Bindings 4.1.5) it is stated that RelayState "MAY be the URL of a resource at the service provider."
It looks like Google is using RelayState
for the target URL even on SP-initiated sign on, which is perfectly fine. But the IDP should, as the documentation says, just relay it back.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…