私は、Spring SecurityのWebSecurityConfig
を管理者権限に使用しています。 と、春のアプリケーションが起動したときにアクセス権が1回だけロードされました。websecurityconfigランタイムを再ロードするにはどうすればいいですか?
許可が変更された場合、どうすれば手動でWebSecurityConfig
を実行時にリロードできますか?
これは私のWebSecurityConfig
コードです:
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter
{
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/css/**").permitAll()
.antMatchers("/js/**").permitAll()
.antMatchers("/rest/login").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/boss/login")
.permitAll()
.and()
.logout()
.permitAll();
http.csrf().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authProvider);
}
}
私は同じ問題を抱えています(アプリケーションを起動した後に追加されたユーザーを認識するためにはSpringブートが必要ですが、このクラスは起動時に一度だけ実行され、再度実行されなかったようです)。コードを使って例を挙げてもらえますか?ログインを制御する別のページからconfigureGlobal()をどのように呼び出しますか? GreetingController.javaのように、ここの例: https://spring.io/guides/gs/serving-web-content/ –