Skip to content

Conversation

@minwoox
Copy link
Contributor

@minwoox minwoox commented Sep 2, 2025

Motivation:
The default SsoHandler currently omits relayState when its length exceeds 80 characters. Although the SAML spec defines an 80-character limit, many implementations do not strictly enforce it, and this restriction is often too tight in practice.

References:

Modifications:

  • Introduced SamlServiceProviderBuilder.relayStateMaxLength() to configure the maximum length.

Result:

  • You can override the default 80-character restriction for SAML relayState.

The default `SsoHandler` currently omits `relayState` when its length exceeds 80 characters.
Although the SAML spec defines an 80-character limit, many implementations do not strictly enforce it,
and this restriction is often too tight in practice.

References:
- https://docs.oasis-open.org/security/saml/v2.0/saml-bindings-2.0-os.pdf
- https://help.salesforce.com/s/articleView?id=000387925&type=1

Modifications:
- Introduced `SamlServiceProviderBuilder.relayStateMaxLength()` to configure the maximum length.

Result:
- You can override the default 80-character restriction for SAML relayState.
@minwoox minwoox added this to the 1.34.0 milestone Sep 2, 2025
@minwoox minwoox requested a review from ikhoon as a code owner September 2, 2025 05:21
// The value MUST NOT exceed 80 bytes in length and SHOULD be integrity protected by the entity
// creating the message independent of any other protections that may or may not exist
// during message transmission.
if (relayState.length() > 80) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to check the relayState length here because it's not set in the default SsoHandler if it exceeds 80 characters, so let me just remove this condition.
Additionally, we were not checking this limit in the post binding, even though the Spec says it should.

@minwoox minwoox changed the title Motivation: Make SAML relayState max length configurable Sep 2, 2025
Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants