I'm trying to set up pac4j for multitenant saml auth in a spring boot app - a different saml provider for each tenant and domain
I've got two saml clients declared with separate urls and metadata, and am using the url parameter ?client_name=SAML2Client2 to force the right saml client to be used.
The log shows the saml clients both being there and the correct one being selected by name, however the callback url is the global default.
clients: Saml2Client,Saml2Client2
currentClients: [#SAML2Client# | name: SAML2Client2 | callbackUrl: http://localhost:8000/callback?client_name=SAML2Client2 | callbackUrlResolver: org.pac4j.core.http.DefaultCallbackUrlResolver@37fcf1f6 | ajaxRequestResolver: org.pac4j.core.http.DefaultAjaxRequestResolver@655b512b |]
requestedUrl: http://localhost:8080/saml/?client_name=SAML2Client2
Using SP entity ID http://saml2:8088/callback?client_name=SAML2Client2
In normal multitenant each tenant has its own domain, for example my test ones are saml1 and saml2 (currently just configured locally in my hosts file).
How can I override the callback url so that I don't need a third generic domain to handle callbacks on? In production it makes little sense to have a generic url rather than accepting callbacks in the production per-tenant domains.
I've already got the service provider entity id set on the config for the saml client:
I'm assuming that the same cause of the callback url being the default one is what causes the actual saml request sent by the browser to have localhost rather than "saml2" in the service provider url (this is breaking the remote IdP saml verifications)
Is what I want possible in pac4j?
Many thanks,
Anton