CAS login returnUrl

46 views
Skip to first unread message

Charl Thiem

unread,
Nov 14, 2018, 5:16:10 AM11/14/18
to cas-...@apereo.org
Hi

It seems like a rooky question, but I can't seem to Google this...
We want to specify a returnUrl where CAS should foward to after a successful login.

E.g On our application, the user can browse anonymously until a certain point. Lets say browsing for courses a student can apply for. At the course info page the user selects to Apply for the course. At this point we'd like to redirect to CAS to allow the student to login, but come back to this page after signing in to complete the application wizzard.

By default CAS redirects to our service path (home page). Is there a way to override this?

Regards / Groete
Charl Thiem
Senior Developer
IT Infrastructure Manager





See OpenCollab email disclaimer at http://www.opencollab.co.za/email-disclaimer

Mac Reid

unread,
Nov 14, 2018, 8:25:06 AM11/14/18
to cas-...@apereo.org
We configure our service URL to match the return point when we enforce authentication. That is, if I go to https://www.example.com/secure/page.html the CAS redirect URL will be https://sso.example.com/cas/login?service=https%3A%2F%2Fwww.example.com%2Fsecure%2Fpage.html.

In our json service registry, we use regex registered services and allow everything on a website:

{
  @class: org.apereo.cas.services.RegexRegisteredService
  id: 1000
  name: Some App
  serviceId: https://(www\.)?example.com(:443)?/.*

That may or may not work for you.

- Mac

James Mackerel

unread,
Nov 20, 2018, 10:23:04 PM11/20/18
to CAS Community
You may redirect user to login path with a redirect parameter, like this:



Then you do what you usually do in login handler, just wirte session and set cookies etc, and after processing login, redirect your user to "/secure/page".

We do this all the time, and it works fine. But you have to check your URL Encode carefully, notice that redirect param was URL encoded twice.


在 2018年11月14日星期三 UTC+8下午6:16:10,Charl Thiem写道:
Reply all
Reply to author
Forward
0 new messages