Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class LogoutConfigurer

  1. Object
  2. SecurityConfigurer
  3. LogoutConfigurer

Sign-out: POST /logout ends the session, forgets who was signed in and redirects to /login?logout. A chain with formLogin has it without asking; any other chain has it once it calls http.logout(...).

http.logout(logout -> logout
        .logoutUrl("/signout")
        .logoutSuccessUrl("/")
        .deleteCookies("remember"));

The request must be a POST while CSRF protection is on, so that a link on another site cannot sign a user out; with it off, any method does.

Methods

public LogoutConfigurer logoutUrl(String logoutUrl)The path that signs out.
public LogoutConfigurer logoutRequestMatcher(RequestMatcher logoutRequestMatcher)The requests that sign out, in place of the path and its method rule.
public LogoutConfigurer logoutSuccessUrl(String logoutSuccessUrl)Where a signed-out user goes.
public LogoutConfigurer logoutSuccessHandler(LogoutSuccessHandler logoutSuccessHandler)Answers the sign-out itself, instead of the redirect.
public LogoutConfigurer invalidateHttpSession(boolean invalidateHttpSession)Whether signing out ends the session; true unless changed.
public LogoutConfigurer clearAuthentication(boolean clearAuthentication)Whether signing out forgets who was signed in; true unless changed.
public LogoutConfigurer deleteCookies(String... cookieNamesToClear)Cookies to delete at sign-out, by name; each must have been set with the path /.
public LogoutConfigurer addLogoutHandler(LogoutHandler logoutHandler)Something more to undo at sign-out; runs before the session ends.
public LogoutConfigurer permitAll()Lets everyone reach the page a signed-out user is sent to.
public void init(HttpSecurity http)Shares what other parts need to know; nothing by default.
public void configure(HttpSecurity http)Adds this part’s filters; nothing by default.

Inherited methods

Method details

logoutUrl

public LogoutConfigurer logoutUrl(String logoutUrl)
The path that signs out.

logoutRequestMatcher

public LogoutConfigurer logoutRequestMatcher(RequestMatcher logoutRequestMatcher)
The requests that sign out, in place of the path and its method rule.

logoutSuccessUrl

public LogoutConfigurer logoutSuccessUrl(String logoutSuccessUrl)
Where a signed-out user goes.

logoutSuccessHandler

public LogoutConfigurer logoutSuccessHandler(LogoutSuccessHandler logoutSuccessHandler)
Answers the sign-out itself, instead of the redirect.

invalidateHttpSession

public LogoutConfigurer invalidateHttpSession(boolean invalidateHttpSession)
Whether signing out ends the session; true unless changed.

clearAuthentication

public LogoutConfigurer clearAuthentication(boolean clearAuthentication)
Whether signing out forgets who was signed in; true unless changed.

deleteCookies

public LogoutConfigurer deleteCookies(String... cookieNamesToClear)
Cookies to delete at sign-out, by name; each must have been set with the path /.

addLogoutHandler

public LogoutConfigurer addLogoutHandler(LogoutHandler logoutHandler)
Something more to undo at sign-out; runs before the session ends.

permitAll

public LogoutConfigurer permitAll()
Lets everyone reach the page a signed-out user is sent to.

init

public void init(HttpSecurity http)
Shares what other parts need to know; nothing by default.

configure

public void configure(HttpSecurity http)
Adds this part’s filters; nothing by default.