Skip to content

Validate AuthnContextClassRef in SAML Response when brokering #55261

Description

@ahus1

Enhancement Description

Validate the AuthnContextClassRef returned in the SAML Response from a brokered SAML identity provider against the authnContextClassRefs configured on the identity provider, honoring the configured comparison type. Today Keycloak sends the configured authnContextClassRefs in the outbound AuthnRequest, but the broker endpoint accepts any class reference in the response.

Value Proposition

An identity provider that returns a weaker authentication context than requested (for example unspecified instead of an MFA class) is currently accepted without notice. Validating the response allows administrators to rely on the requested authentication level when brokering.

Goals

  • Reject a SAML Response whose AuthnContextClassRef does not satisfy the configured authnContextClassRefs and comparison type.
  • Leave identity providers without configured authnContextClassRefs unaffected.

Non-Goals

Discussion

No response

Notes

Related to #55108, which documents that brokering is not integrated with LoA and announces a follow-up enhancement. A first proposal exists in #50044, which changes SAMLEndpoint. Open points: behavior for comparison types other than exact (minimum, maximum, better), and whether this needs a backwards-compatibility switch as it can reject logins that work today.

Activity

  1. added
    area/authenticationAuth flows, authenticators, required actions, OTP, password policies, brute force
    on Nov 17, 2026
  2. added
    area/identity-brokeringIdentity brokering — external IdPs (social, OIDC, SAML), account linking
    on Nov 17, 2026
  3. mjatin2007 commented on Nov 17, 2026

    @mjatin2007
    Contributor

    Thanks for opening this, @ahus1. As offered on #50044, I’m happy to help with a replacement PR alongside @danSayag and the original team. Is anyone already taking this forward, and what scope would you prefer for the first PR given the comparison and compatibility questions?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    Value

    None yet

    Effort

    None yet

    Votes

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions