• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

How can i logout successfully with spring security using FreeMarker

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having problems trying to logout from my application, when I press the logout button in my application it shows me the login page again, but if write in the search bar in my browser I can go to any page in my application without having to login again, it seems that when I press the logout link I don't logout at all.

here are my mave dependencies



I'm using FreeMarkes as my template engine and I use this expression to have access to Jsp Security Tags.


here is my login controller:



And here is my spring security configuration, I'm using a java configuration and no XML


and my AutProvider class


and here is how I call the logout link in my page


I tried changing to but when I do this it says 404 not found.
 
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jhon from this post and your previous post, I think you are struggling to match paths and how it is mapped to URLs.
Can you assiduously go through the links, I've mentioned below?

1. http://docs.spring.io/spring-framework/docs/2.5.x/api/org/springframework/util/AntPathMatcher.html
2. Link 1 should be sufficient. If needed, do read from this link more - http://ant.apache.org/manual/dirtasks.html#patterns. If not, skip this and move.
3. Go through the configurations mentioned in the spring mvc site. - http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html
4. An example for the above (3) is here - http://www.springbyexample.org/examples/simple-spring-mvc-form-annotation-config-webapp.html

Once you're done, you might want to learn FrontControllers and View Resolvers (here).
Finally, this is good read - http://www.javaranch.com/journal/200603/frontman.html

Also, to understand passing querystrings - you need to check this.
1. https://coderanch.com/t/584771/JSP/java/Passing-parameters-URL-query-string
2. https://www.daniweb.com/web-development/jsp/threads/394222/pass-multiple-value-in-query-string-in-jsp
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is your logout coming via login?
What are you intending to do in this code - "login/login?logout"
 
Jhon Parker
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Arun Kumarr wrote:Why is your logout coming via login?
What are you intending to do in this code - "login/login?logout"



here is my controller that would handle that path



this works but i return the same login page that i have, i did this because when i try to map the same path form my logoutUrl and successLogOutUrl i get a loop errror because i think that i can't use the same url for both

here is my actual secuirty configuration



i created a logOut page that is a exact copy of my login page, because when i use /login/login?logout it works i see the login page again but i'm not logout at all, i can put any direction in my search bar and i will go there without having to login.

that's why i created a exact copy of my login page but i think it shouldn't be like that, since all the examples i had whatched they use this login?logout url.




Thanks for the info you posted it helped me to understand betterr the **/ notation
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a very simple logout mechanism worked out by spring.
Try using it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!