I want to authenticate against Keycloak from a Cake app using the Auth-Middleware. I mocked it in AppController which worked out well, and I am pretty sure that it's going to work with the middleware as well. I wrote 2 new Authenticator and 1 Identifier class for that
However, there is a problem I didn't see: I need to redirect to the keycloak instance from one of the Authenticator classes. I tried to throw UnauthenticatedException
, but get an error, that Authentication is required to continue
.
The exception throw wasn't my fav anyway, as it seemed difficult to store the state for csrf protection that way.
So: could anyone advice me how to redirect from inside an Authenticator class?