Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(request): generate correct redirect requests #93

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

edpaget
Copy link

@edpaget edpaget commented Feb 20, 2025

Previously we could not generate correctly signed AuthnRequests using
HTTP-Redirect bindings. This happened for three reasons:

  1. We were inserting the signature into the body of the SAML
    AuthnRequest. When sending an AuthnRequest using HTTP-Redirect the
    signature is included as a query param alongside the encoded SAML
    request

  2. We were specifying the wrong binding type. Our requests used
    HTTP-Post binding. I think most SAML idps are pretty forgiving about
    what a request looks like but get more string when you put them into the
    verification mode that checks signatures Okta included here.

  3. We did not specify a NameIDPolicy. Basically the same kind of thing
    as point number 2.

As part of fixing those issues I decided to make our AuthnRequest flow
use more of the OpenSAML library instead of using the hiccup-based XML
generation. I plan to follow up to convert our Logout/SLO handling to
work in the same way and clean up unused functions in the crypto/coerce
namespaces once that is done.

@edpaget edpaget requested a review from camsaul as a code owner February 20, 2025 22:21
@edpaget
Copy link
Author

edpaget commented Feb 20, 2025

depends on @danielcompton's #90 I'll rebase away those commits once that's done.

danielcompton and others added 9 commits February 21, 2025 23:41
https://shibboleth.atlassian.net/wiki/spaces/OSAML/overview

Updates signed and encrypted SAML assertion as it wasn't valid under
OpenSAML 5.
this fails only when running under cloverage with a reflection issue.
Explicitly typehinting fixes it.
Previously we could not generate correctly signed AuthnRequests using
HTTP-Redirect bindings. This happened for three reasons:

1. We were inserting the signature into the body of the SAML
AuthnRequest. When sending an AuthnRequest using HTTP-Redirect the
signature is included as a query param alongside the encoded SAML
request

2. We were specifying the wrong binding type. Our requests used
HTTP-Post binding. I think most SAML idps are pretty forgiving about
what a request looks like but get more string when you put them into the
verification mode that checks signatures Okta included here.

3. We did not specify a NameIDPolicy. Basically the same kind of thing
as point number 2.

As part of fixing those issues I decided to make our AuthnRequest flow
use more of the OpenSAML library instead of using the hiccup-based XML
generation. I plan to follow up to convert our Logout/SLO handling to
work in the same way and clean up unused functions in the crypto/coerce
namespaces once that is done.

Closes #91
@edpaget edpaget force-pushed the ep-fix-redirect-generation branch from efb48ab to b7f5605 Compare February 21, 2025 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants