Skip to content

Instantly share code, notes, and snippets.

@boudhayan-dev
Created May 1, 2021 18:41
Show Gist options
  • Save boudhayan-dev/c4c46efe6c02a8b61df826c651429853 to your computer and use it in GitHub Desktop.
Save boudhayan-dev/c4c46efe6c02a8b61df826c651429853 to your computer and use it in GitHub Desktop.
@Configuration
@EnableWebSecurity(debug=true)
public class MultipleSecurityCofig extends WebSecurityConfigurerAdapter {
@Order(1)
@Configuration
public static class EmployeeConfig extends WebSecurityConfigurerAdapter{
@Override
protected void configure(HttpSecurity http) throws Exception {
http.antMatcher("/api/v1/employee/**").authorizeRequests().antMatchers("/api/v1/employee/**").permitAll()
.and().sessionManagement().disable()
.cors().disable()
.csrf().disable()
.logout().disable()
.requestCache().disable()
.headers().disable();
}
}
@Order(2)
@Configuration
public static class ManagerConfig extends WebSecurityConfigurerAdapter{
@Override
protected void configure(HttpSecurity http) throws Exception {
http.antMatcher("/api/v1/manager/**").authorizeRequests().antMatchers("/api/v1/manager/**").permitAll()
.and().addFilterAfter(new AuditLogFilter(), FilterSecurityInterceptor.class);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment