Skip to content

providers/saml: fix handle Accept: application/xml for SAML Metadata endpoint (#12483)#12518

Merged
BeryJu merged 2 commits intogoauthentik:mainfrom
Rynoxx:bugfix/saml-metadata-accept-12483
Dec 30, 2024
Merged

providers/saml: fix handle Accept: application/xml for SAML Metadata endpoint (#12483)#12518
BeryJu merged 2 commits intogoauthentik:mainfrom
Rynoxx:bugfix/saml-metadata-accept-12483

Conversation

@Rynoxx
Copy link
Contributor

@Rynoxx Rynoxx commented Dec 30, 2024

Details

Currently when requesting SAML metadata download with Accept: application/xml it returns a status 406 Not Acceptable.
Expected behavior would be to return the data as is done when no Accept header is sent.

This adds a new renderer_class to the SAML metadata download endpoint which allows application/xml in the Accept header.

Now both curl "http://localhost:9000/api/v3/providers/saml/1/metadata/?download"
and
curl -H "Accept: application/xml" "http://localhost:9000/api/v3/providers/saml/1/metadata/?download"
produce the same output, instead of the latter returning 406.

closes #12483


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web) No frontend changes made

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@Rynoxx Rynoxx requested review from a team as code owners December 30, 2024 14:48
@netlify
Copy link

netlify bot commented Dec 30, 2024

Deploy Preview for authentik-storybook canceled.

Name Link
🔨 Latest commit 52a411c
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/6772e5b0c9d70a0008a97f80

@netlify
Copy link

netlify bot commented Dec 30, 2024

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 52a411c
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/6772e5b18f9542000890ba79
😎 Deploy Preview https://deploy-preview-12518--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@codecov
Copy link

codecov bot commented Dec 30, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.75%. Comparing base (91145b7) to head (52a411c).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
authentik/providers/saml/api/providers.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12518      +/-   ##
==========================================
- Coverage   92.76%   92.75%   -0.01%     
==========================================
  Files         770      770              
  Lines       38859    38873      +14     
==========================================
+ Hits        36047    36057      +10     
- Misses       2812     2816       +4     
Flag Coverage Δ
e2e 48.70% <35.29%> (-0.06%) ⬇️
integration 24.58% <0.00%> (-0.01%) ⬇️
unit 90.38% <94.11%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
@BeryJu BeryJu merged commit 8938fa5 into goauthentik:main Dec 30, 2024
@Rynoxx Rynoxx deleted the bugfix/saml-metadata-accept-12483 branch December 30, 2024 22:37
kensternberg-authentik added a commit that referenced this pull request Jan 8, 2025
* main:
  website/integrations: meshcentral: document (#12509)
  stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#12524)
  core: bump goauthentik.io/api/v3 from 3.2024121.2 to 3.2024121.3 (#12522)
  web: bump API Client version (#12520)
  website/integrations: chronograf: document (#12474)
  website/integrations: update preparation placeholder (#12507)
  providers/saml: fix handle Accept: application/xml for SAML Metadata endpoint (#12483) (#12518)
  core: bump aws-cdk-lib from 2.173.3 to 2.173.4 (#12513)
  website: bump aws-cdk from 2.173.3 to 2.173.4 in /website (#12514)
  core: bump coverage from 7.6.9 to 7.6.10 (#12499)
  core: bump aws-cdk-lib from 2.173.2 to 2.173.3 (#12500)
  website: bump aws-cdk from 2.173.2 to 2.173.3 in /website (#12501)
  core: bump github.com/go-ldap/ldap/v3 from 3.4.9 to 3.4.10 (#12502)
  website/docs: New "Whats Up Docker" URL (#12488)
@franciscomfcmaia
Copy link

Has this been released in 2024.12.2? Still facing the same issue.

@jorhett
Copy link
Contributor

jorhett commented Feb 18, 2025

Not working 2024.12.3 either 😢

@Rynoxx
Copy link
Contributor Author

Rynoxx commented Feb 24, 2025

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.

Unable to retrieve SAML metadata when Accept header is set

4 participants