-
I am trying to make multiple providers work as described here: https://github.com/zmartzone/mod_auth_openidc/wiki/Authorization#3-access-to-different-url-paths-on-a-per-provider-basis But I am failing because the OIDCDiscoverURL does not seem to support match from LocationMatch The example is my starting point (copied exactly as is from above url):
It works as written there, but when I combine it with the example using expressions: https://github.com/zmartzone/mod_auth_openidc/wiki/Authorization#expressions-in-require-statements
it will not work. The match is just passed to the OIDCDiscoverURL as is.
But this leads just to it redirecting to https://www.example.com/example/redirect_uri?iss=https%3A%2F%2F%{env:MATCH_DOMAIN}.example.com without replacing the variable / the match. I tried many different approaches, one of them using RewriteEngine, which nearly worked, but this will not start the Discovery which is also something I need:
This is actually almost there, but I want auto discovery, because there are lots and lots of such subdomains. The auto discovery works when I use a fixed OIDCDiscoverURL (without broken %{env:MATCH_DOMAIN}), but not when I use the Rewrite. How do I allow Discovery here? Then I would be at my goal. Thank you for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
using an expression in |
Beta Was this translation helpful? Give feedback.
-
After some thorough digging through the code I reverse engineered a solution.
The only caveat is that an expired browser session also ends up in the IF and then the process stops there. The user sees a 401 error and nothing else happens. So I reload in that case and return a 403 if the auth was succesfull but the iss claim was not. So the complete solution is as follows:
|
Beta Was this translation helpful? Give feedback.
After some thorough digging through the code I reverse engineered a solution.
The discovery is only allowed when the csrf cookie and query parameter are set, so I set them manually when using RewriteRule (instead of desired OIDCDiscoverURL, which does that internally/automatically).