Package org.springframework.security.web.authentication.logout

# Class HttpStatusReturningLogoutSuccessHandler

java.lang.Object
org.springframework.security.web.authentication.logout.HttpStatusReturningLogoutSuccessHandler

All Implemented Interfaces:
  `LogoutSuccessHandler`

public class HttpStatusReturningLogoutSuccessHandler extends Object implements LogoutSuccessHandler
Implementation of the `LogoutSuccessHandler`. By default returns an HTTP status code of `200`. This is useful in REST-type scenarios where a redirect upon a successful logout is not desired.

Since:
  4.0.2

## Constructor Summary

Constructors
Constructor
Description
`HttpStatusReturningLogoutSuccessHandler()`
Initialize the `HttpStatusLogoutSuccessHandler` with the default `HttpStatus.OK`.
`HttpStatusReturningLogoutSuccessHandler(org.springframework.http.HttpStatus httpStatusToReturn)`
Initialize the `HttpStatusLogoutSuccessHandler` with a user-defined `HttpStatus`.

## Method Summary

Modifier and Type
Method
Description
`void`
`onLogoutSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication)`
Implementation of `LogoutSuccessHandler.onLogoutSuccess(HttpServletRequest, HttpServletResponse, Authentication)` .

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HttpStatusReturningLogoutSuccessHandler

public HttpStatusReturningLogoutSuccessHandler(org.springframework.http.HttpStatus httpStatusToReturn)
Initialize the `HttpStatusLogoutSuccessHandler` with a user-defined `HttpStatus`.

Parameters:
  `httpStatusToReturn` - Must not be `null`.

### HttpStatusReturningLogoutSuccessHandler

public HttpStatusReturningLogoutSuccessHandler()
Initialize the `HttpStatusLogoutSuccessHandler` with the default `HttpStatus.OK`.

## Method Details

### onLogoutSuccess

public void onLogoutSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication) throws IOException
Implementation of `LogoutSuccessHandler.onLogoutSuccess(HttpServletRequest, HttpServletResponse, Authentication)` . Sets the status on the `HttpServletResponse`.

Specified by:
  `onLogoutSuccess` in interface `LogoutSuccessHandler`
Throws:
  `IOException`