Spring Security (10)--Sign out Logout

Source: Internet
Author: User

To implement the Logout feature we need to define the logout element under the HTTP element, so spring security will automatically add a filter logoutfilter to Filterchain for us to handle the exit login. When we specify that the HTTP element's Auto-config property is true, the logout definition is automatically configured, at which point we exit the login by default with the URL "/j_spring_security_logout", You can change the default address of the exit login by logout The Logout-url property of the element.

<security:logout logout-url= "/logout.do"/>

In addition, we can also specify the following properties for logout:

Property name

function

Invalidate-session

Indicates whether to invalidate the current session after exiting the login, which defaults to true.

Delete-cookies

Specifies the name of the cookie that needs to be deleted after logging out, with multiple cookies separated by commas.

Logout-success-url

Specifies the URL to redirect after successfully exiting the login. It is important to note that the corresponding URL should be accessible without having to log in.

Success-handler-ref

Specifies a reference to handle the Logoutsuccesshandler that successfully exited the login.

(Note: This article is written based on spring Security3.1.6)

(Note: Original article, reproduced please indicate the source.) Original address: http://haohaoxuexi.iteye.com/blog/2162334)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.