I have successfully implemented a CAS authentication in my application with phpCAS. However, after logging in, I am always redirected back to the application's start page, even if I requested a specific URL within the application.
I have been trying to find out how to keep track of the URL to return to after login, but could not find anything.
Put simply, this is my code:
phpCAS::client(
CAS_VERSION_2_0,
'cas.example.host',
443,
'https://cas.example.host:443/login',
'https://my-application.host'
);
$client = phpCAS::getCasClient();
$client->renewAuthentication();
Does someone know how I can store the URL to return to anywhere? Using a URL parameter would be fine, but I don't know where to set it.
As a session must already be active in the application when running the phpCAS authentication callbacks, so the return URL can simply be handled on the application level by storing it in the application's session.
Pseudo code to demonstrate the logic: