Testing with a CAS server locally

40 views
Skip to first unread message

Sameer Thajudin

unread,
Feb 19, 2023, 5:07:07 AM2/19/23
to CAS Community
I set up a CAS server locally so that I can test an application. Both the client application and CAS server runs on the same machine.

The application redirects to the CAS server but the CAS server sees that the client IP address and the CAS server IP address is the same as shown below:

CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1

I believe this is the reason why when the CAS server redirects back after authentication, the base URL of the redirect URL is the URL of the CAS server(localhost and CAS server port).

As both the client application and CAS server runs on the same machine on different ports, how can I ensure that the CAS server after authentication redirects to the client app url(localhost and client application port) rather than the CAS server?

Thank you




  

Ray Bon

unread,
Feb 21, 2023, 11:55:53 AM2/21/23
to cas-...@apereo.org
Sameer,

Cas should preserve the url, port, path, and parameters from the client.
If not, you could use something like nginx as a proxy in front of your client application and cas.

Ray

On Sat, 2023-02-18 at 22:40 -0800, Sameer Thajudin wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.

Pablo Vidaurri

unread,
Feb 27, 2023, 12:31:41 PM2/27/23
to CAS Community, same...@gmail.com
I test the same way. I have a simple CAS client using Spring Security running on localhost but on a different port that CAS. When logging into to t heis simple client, i get redirected to CAS login page then after successful login I get redirected back to my app.

Make sure your cas client is configured apprpiately, in my simple app I have:
server.port=9000
app.service.home=http://localhost:9000/
cas.server.root=https://localhost:8443
cas.url.prefix=${cas.server.root}/cas/
cas.service.login=${cas.server.root}/cas/login
cas.service.logout=${cas.server.root}/cas/logout


-psv

Reply all
Reply to author
Forward
0 new messages