Skip to content

eager-zh/spring-security-scoped-value

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

spring-security-scoped-value

This is a small POC to illustrate a discussion on StackOverflow question Spring Security Virtual Threads and ThreadLocal.

Custom SecurityContextHolderStrategy which retrieves and saves SecurityContext from and to a ScopedValue is installed. Tomcat Handler customizer registers an ExecutorService which starts a virtual thread, with the ScopedValue bound to it.

To test, run Spring Boot SpringSecurityScopedValueApplication, point your browser to a protected resource, make sure that current SecurityContextHolderStrategy is our custom one, and see the dump of current Authentication in the console log.

About

Simple Spring Boot Spring MVC application demonstrates the usage of Scoped Value for Spring Security Context

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages