Created
February 28, 2019 09:34
-
-
Save Phoenix124/4aef2832b91ecb556564ad4e202486c9 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
@Configuration | |
@Order(1) | |
public static class BasicAuthenticationAdapter extends WebSecurityConfigurerAdapter { | |
private final AuthenticationEntryPoint authEntryPoint; | |
@Autowired | |
public BasicAuthenticationAdapter(AuthenticationEntryPoint authEntryPoint) { | |
this.authEntryPoint = authEntryPoint; | |
} | |
protected void configure(HttpSecurity http) throws Exception { | |
http | |
.antMatcher("/orders**") | |
.authorizeRequests() | |
.anyRequest().hasRole("USER") | |
.and() | |
.csrf().disable() | |
.httpBasic().authenticationEntryPoint(authEntryPoint) | |
.and() | |
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment