I have an app using pac4j with a JWT client (i.e. a direct) and I would like to use AnonymousClient as fallback. How can I make sure AnonymousClient will be called AFTER JwtClient? Is DefaultSecurityLogic respecting the order the clients are provided?
I also had a look at setProfileFactoryWhenNotAuthenticated, but in the doc they only mention it's use with indirect clients (and I tried with my JwtClient and it didn't work).
To make it even more spicy I actually use an indirect client and I would like AnonymousClient to be used as a fallback for the whole chain of clients. Using setProfileFactoryWhenNotAuthenticated to my indirect client would not work as I want AnonymousCLient to be used even when the direct client is discarded because the request is AJAX.
To sum-up what I am trying to do is:
- If AJAX: direct clients > Anonymous
- If not AJAX: direct clients > indirect client > Anonymous
Any idea?