cas-security-spring-boot-starter icon indicating copy to clipboard operation
cas-security-spring-boot-starter copied to clipboard

Cannot get targetUrl

Open Georgeqhh opened this issue 6 years ago • 5 comments

nginx :

listen       9001;
location / {
            proxy_pass http://192.168.208.1:8762/main;
        }

when I access localhost:9001, after login, SavedRequestAwareAuthenticationSuccessHandler cannot get the targetUrl so that redirect to http://192.168.208.1:8762, but what I want is http://192.168.208.1:8762/main

Georgeqhh avatar Nov 06 '18 03:11 Georgeqhh

I acess localhost:9001 and then nginx will pass to http://192.168.208.1:8762/main(url1), url1 is required to login,so the application will redirect to http://localhost:8080/cas/login?service=http://192.168.208.1:8762/login. After logining cas,it redirect to http://192.168.208.1:8762/login, but it doesn't carry the the session that I get in accessing localhost:9001 ,so that cannot get the request that save in session that it redirect to http://192.168.208.1:8762. How to carry the session that I get in accessing localhost:9001 when it redirect to http://192.168.208.1:8762/login?

Georgeqhh avatar Nov 07 '18 14:11 Georgeqhh

whether security+cas requires nginx's domain and service's domain are the same?

Georgeqhh avatar Nov 09 '18 03:11 Georgeqhh

@Georgeqhh what is your current application.{yml/properties} ? I would like to see your app configuration

kakawait avatar Dec 05 '18 09:12 kakawait

security:
  cas:
    server:
      base-url: http://.../cas
      paths:
        login: ${security.cas.server.base-url}/login
    service:
      base-url: http://192.168.208.1:8762
      paths:
        login: /login

Georgeqhh avatar Dec 08 '18 08:12 Georgeqhh

@Georgeqhh

regarding

when I access localhost:9001, after login, SavedRequestAwareAuthenticationSuccessHandler cannot get the targetUrl so that redirect to http://192.168.208.1:8762, but what I want is http://192.168.208.1:8762/main

Why are you not tweaking your RP to

listen       9001;
location /main {
    proxy_pass http://192.168.208.1:8762/main;
}

Because /main is part of your external URL

kakawait avatar Dec 17 '18 15:12 kakawait