I am using Spring security in my web application and I am using Javaconfig for it. Recently we have also added Spring SAML authentication in the application and finally got it working after some hurdles. Inside the WebApplicationInitializer
's onStartUp
() I am loading SpringSecurity configuration or SpringSaml configuration based on some pre condition.
Now how can I do this dynamically ? Actually I will introduce a button and once admin clicks on this button admin and all users will be logged out and context should be reloaded. At this point of time its ok if system is inaccessible for sometime and it re initializes application context (which is actually my goal) ?
In other words how can I call the onStartUp()
method of WebApplicationInitializer
?
You use Spring Environment Profiles to control which security configuration is loaded.
To switch profile, you then update the configuration file listing the active profiles, and reload the app.
See Spring Boot Reference Guide - 25. Profiles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With