Subject changes/Problems with CORS

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Subject changes/Problems with CORS

I am pretty new to Shiro.
I have different projects for the frontend and backend. My jetty server is running on localhost:4200 ( using maven jetty plugin ) and the frontend ( angular2 dart app ) is running on localhost:8080 ( with "pub serve" ).
The problem is, that the server says, that the login is correct and if I print currentUser.isAuthenticated() right after that, it returns true. The currentUser is the Subject.
But if I login again ( click on login button again in the frontend ), then it should say "Already logged in", but .isAuthenticated() returns false now ( then it will login again and return true, but the subject changes all the time, so I can't login and visit another website and am still authenticated ).

If I deploy the frontend to the server, so both the frontend and server are running on localhost:4200 then it works fine. A second login attempt will print me "Already logged in", because the currentUser is already authenticated.

As I said, I am pretty new to shiro ( and also pretty new to angular2, jetty etc. ). But always deploying the frontend takes too much time, so I'd like to have them run separated for a fast workflow.

Any ideas how I can fix this problem? It probably has todo with the request coming from another port.