Skip to content

Clear Site Data references non-existent constructor #16948

Closed
@ivopogace

Description

@ivopogace

Describe the bug
I was following the spring logout documentation as in link below
and i ran in IllegalArgumentException error when i started the application when configuring the logout handler.
https://docs.spring.io/spring-security/reference/servlet/authentication/logout.html#clear-all-site-data
Image

Apparently this is updated in the code documentation that the arguments should not be null or empty, but not on the website.

Image

To Reproduce
HeaderWriterLogoutHandler clearSiteData = new HeaderWriterLogoutHandler(new ClearSiteDataHeaderWriter());
http
.logout((logout) -> logout.addLogoutHandler(clearSiteData))

Expected behavior
The above configuration clears out all site data as stated in the documentation.
Probably the wanted behavior can be achieved if we provide the ClearSiteDataHeaderWriter.Directive.ALL as argument.
Solution would be updating the website documentation to:
HeaderWriterLogoutHandler clearSiteData = new HeaderWriterLogoutHandler(new ClearSiteDataHeaderWriter(ClearSiteDataHeaderWriter.Directive.ALL));
http
.logout((logout) -> logout.addLogoutHandler(clearSiteData))

Sample
Starting the sample below will throw the IllegalArgumentException since we are not providing any Directive as agrument.
[A link to a GitHub repository with a minimal, reproducible sample.](https://github.com/ivopogace/IAE)

Metadata

Metadata

Assignees

Labels

in: docsAn issue in Documentation or samplestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions