Invalid Service error when deploying this to another server. Webcast returns with a ticket but the validate service of the library throws invalid service
Im using this package on a local laravel project. Ive set my .env variables to:
CAS_REDIRECT_LOGIN_ROUTE="cas-return"
CAS_REDIRECT_LOGIN_URL="http://localhost:8000/ecas"
This redirects to webgate using the service=http://localhost:8000/ecas. It returns with a ticket and the package validates this. A user is given and everything works fine.
But when deploying this to our development server:
https://XXX.XXX.XXX.europa.eu/
and set the .env variables to:
CAS_REDIRECT_LOGIN_ROUTE="cas-return"
CAS_REDIRECT_LOGIN_URL="https://XXX.XXX.XXX.europa.eu/ecas"
Then the following starts happening: It redirects to webgate using the service=https://XXX.XXX.XXX.europa.eu/ecas and returns with a ticket. The package validates but now throws an invalid service error.
Everything else is the same as on the localhost. Only the login url is changed.
What could cause this? Im aware that the "INVALID SERVICE" means that the service is not correct. But why? Its the same service i passed to the login, so it should be the same as when validated right?
This is the error thrown within the laravel logs.
[2023-03-14 13:02:42] production.ERROR: CAS authentication failure: {
"serviceResponse" : {
"authenticationFailure" : {
"code" : "INVALID_SERVICE",
"description" : "ticket 'ST-XXX' does not match supplied service"
}
}
}
{"exception":"[object] (EcPhp\\CasLib\\Exception\\CasHandlerException(code: 0): CAS authentication failure: {
\t\"serviceResponse\" : {
\t\t\"authenticationFailure\" : {
\t\t\t\"code\" : \"INVALID_SERVICE\",
\t\t\t\"description\" : \"ticket 'ST-XXX' does not match supplied service\"
\t\t}\t
\t}
}
at /var/www/fe/vendor/ecphp/cas-lib/src/Exception/CasHandlerException.php:27)
[stacktrace]
#0 /var/www/fe/vendor/ecphp/cas-lib/src/Handler/ServiceValidate.php(65): EcPhp\\CasLib\\Exception\\CasHandlerException::authenticationFailure()
#1 /var/www/fe/vendor/ecphp/cas-lib/src/Cas.php(152): EcPhp\\CasLib\\Handler\\ServiceValidate->handle()
#2 /var/www/fe/vendor/ecphp/cas-lib/src/Cas.php(186): EcPhp\\CasLib\\Cas->process()
#3 /var/www/fe/vendor/ecphp/cas-lib/src/Cas.php(209): EcPhp\\CasLib\\Cas->requestServiceValidate()
#4 /var/www/fe/vendor/ecphp/laravel-cas/src/Middleware/CasAuthenticator.php(35): EcPhp\\CasLib\\Cas->requestTicketValidation()
If someone could help out, that would be wonderfull. Thank you very much!
Feel free to ask for more information.
Verdruye Axel Streamovations