Skip to content

Trying to implement multiple providers with OIDCDiscoverURL and LocationMatch #745

Answered by GustavR
GustavR asked this question in Q&A
Discussion options

You must be logged in to vote

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).

LoadModule unique_id_module modules/mod_unique_id.so

<LocationMatch /example/(?<DOMAIN>[^/]+)>
  Define ISS https://%{env:MATCH_SUB}.example.com
  AuthType openid-connect
  # we check the claim only if we have a session, if not we redirect to the oidc login endpoint
  <If "%{HTTP_COOKIE} =~ /mod_auth_openidc_session/">
    Require claim iss:${ISS}
  </If>
  <Else>
    Header always add Set-Cookie "x_csrf=%{UN…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@GustavR
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by GustavR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants