Usually SecurityConfig we are doing like
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/index.html").permitAll()
.antMatchers("/profile/**").authenticated()
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/management/**").hasAnyRole("ADMIN", "MANAGER")
.antMatchers("/api/public/test1").hasAuthority("ACCESS_TEST1")
.antMatchers("/api/public/test2").hasAuthority("ACCESS_TEST2")
.antMatchers("/api/public/users").hasRole("ADMIN")
.and()
.httpBasic();
}
I want to get this endpoints ("/api/public/test2") and required authorities "ACCESS_TEST2" from property file or DB (config SecurityConfig extrnaly).
Can I do it? how can I do it?