Last active
March 2, 2018 15:43
-
-
Save dvas0004/9d8308bc61953dd257c74f43bb4ba592 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EnableWebSecurity | |
public class SecurityConfig { | |
@Value("${security.enabled:false}") | |
private Boolean security_enabled; | |
@Configuration | |
@Order(1) | |
public class BasicSecurityConfig extends WebSecurityConfigurerAdapter { | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http.antMatcher("/googleToken").authorizeRequests().anyRequest().permitAll(); | |
http.csrf().disable(); | |
} | |
} | |
@Configuration | |
@Order(2) | |
public class JwtSecurityConfig extends WebSecurityConfigurerAdapter { | |
@Value("${jwtSecret}") | |
private String jwtSecret; | |
@Override | |
protected void configure(HttpSecurity http) throws Exception { | |
http.addFilterAfter(new JWTFilter(jwtSecret), BasicAuthenticationFilter.class); | |
http.authorizeRequests() | |
.antMatchers("/actuator/*").hasAuthority("ACTUATOR") | |
.antMatchers("/**").permitAll(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment