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

Feature Request: Pass custom ACS URL #347

Closed
henryh9n opened this issue Nov 7, 2024 · 1 comment · Fixed by #348
Closed

Feature Request: Pass custom ACS URL #347

henryh9n opened this issue Nov 7, 2024 · 1 comment · Fixed by #348
Assignees
Labels
enhancement New feature or request

Comments

@henryh9n
Copy link
Contributor

henryh9n commented Nov 7, 2024

I have a specific use case with my multi-tenant application.
Since we use dynamic routing (with the tenant name in the URL), utils.get_saml_client() function fails to get the proper URL for the ACS endpoint. The get_reverse finds only the base URL (not the one for tenant).
It happens on this line:

acs_url = domain + get_reverse([acs, "acs", "django_saml2_auth:acs"]) # type: ignore

For example, let's say the base ACS URL is https://example.com/api/acs. Since we support multiple tenants, https://example.com/api/tenant-1/acs and https://example.com/api/tenant-2/acs are also valid ACS URLs, however Django will only find the base one (due to the way we set it up).

Would be nice to have a feature to be able to set this URL manually, instead of reversing it.
IMO, ideally we can have 2 ways to do it:

  1. Static: We set a variable in config which then is used as the ACS URL instead of reverse().
    This would be useful when you have some redirects behind the scene.
  2. Dynamic: We can pass a hook function that dynamically determines the URL.
    Useful when you have dynamic routing and multiple ACS URLs for tenants or other purposes
@mostafa
Copy link
Member

mostafa commented Nov 7, 2024

Hey @henryh9n,

I like the idea the static/dynamic method. We keep backward compatibility while allowing customization of the ACS URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants