Spring boot security console / command line application

Spring boot tutorials usually explain how to protect a spring boot web application, but not a console / command line application (accessed from spring-boot-starter-remote-shell).

For a web application, we just need to go from the WebSecurityConfigurerAdapter , and then override some methods.

Is there an equivalent class for a console / command line application? If not, what is the best way to do this?

+5
source share
1 answer

According to spring-boot reference

If your application uses Spring Security, the shell will use the same default configuration.

If you want Crsh to use your authentication manager you have 2 options

This authentication method will be activated if shell.auth is set to Spring or if explicit shell.auth is not specified and AuthenticationManager is available.

If you need to find a solution for access control with limited access in Csrh, you can also define an AccessDecisionManager bean named "shellAccessDecisionManager" .

See CrshAutoConfiguration

  @Autowired(required = false) @Qualifier("shellAccessDecisionManager") private AccessDecisionManager accessDecisionManager; 
0
source

All Articles