Skip to content

Add RequestAttributeSecurityContextRepository #10918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mbhave opened this issue Feb 28, 2022 · 1 comment
Closed

Add RequestAttributeSecurityContextRepository #10918

mbhave opened this issue Feb 28, 2022 · 1 comment
Assignees
Labels
in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Milestone

Comments

@mbhave
Copy link
Contributor

mbhave commented Feb 28, 2022

As discussed with @rwinch, we can add a SecurityContextRepository implementation that stores the SecurityContext as a request attribute.

@mbhave mbhave added status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement labels Feb 28, 2022
@rwinch rwinch removed the status: waiting-for-triage An issue we've not yet triaged label Feb 28, 2022
@rwinch rwinch self-assigned this Feb 28, 2022
@rwinch rwinch added this to the 5.7.0-M3 milestone Feb 28, 2022
@rwinch rwinch changed the title Provide a way to retrieve the security context for error dispatches with a stateless session policy Add RequestAttributeSecurityContextRepository Mar 4, 2022
@rwinch rwinch added the in: web An issue in web modules (web, webmvc) label Mar 4, 2022
rwinch added a commit that referenced this issue Mar 7, 2022
@rwinch rwinch closed this as completed in bab5d25 Mar 8, 2022
@rwinch
Copy link
Member

rwinch commented Mar 8, 2022

The new repository can be used leveraging the following configuration:

@Bean
DefaultSecurityFilterChain configure(HttpSecurity http) throws Exception {
    http
        // ...
        .securityContext(securityContext -> securityContext
            .securityContextRepository(new RequestAttributeSecurityContextRepository()).and()
        );
    return http.build();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants