BAEL-797 fixing security settings
This commit is contained in:
parent
f23b54220f
commit
909e7a9ecd
|
@ -29,11 +29,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
.httpBasic()
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/*.js","/*.html","/*.ico", "/*").permitAll()
|
||||
.antMatchers("/book-service/books").permitAll()
|
||||
.antMatchers("/zipkin/**").permitAll()
|
||||
.antMatchers("/eureka/**").hasRole("ADMIN")
|
||||
.anyRequest().authenticated()
|
||||
.anyRequest().permitAll()
|
||||
.and()
|
||||
.logout()
|
||||
.and()
|
||||
|
|
|
@ -35,8 +35,9 @@ public class LiveTest {
|
|||
|
||||
@Test
|
||||
public void whenAccessProtectedResourceWithoutLogin_thenRedirectToLogin() {
|
||||
final Response response = RestAssured.get(ROOT_URI + "/book-service/books/1");
|
||||
Assert.assertEquals(HttpStatus.UNAUTHORIZED.value(), response.getStatusCode());
|
||||
final Response response = RestAssured.get(ROOT_URI + "/rating-service/ratings?bookId=1");
|
||||
Assert.assertEquals(HttpStatus.FORBIDDEN.value(), response.getStatusCode());
|
||||
Assert.assertNotNull(response.getBody());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -46,7 +47,7 @@ public class LiveTest {
|
|||
.auth().preemptive().basic("user", "password")
|
||||
.header("X-XSRF-TOKEN", sessionData.getCsrf())
|
||||
.filter(sessionFilter)
|
||||
.get(ROOT_URI + "/book-service/books/1");
|
||||
.get(ROOT_URI + "/rating-service/ratings?bookId=1");
|
||||
Assert.assertEquals(HttpStatus.OK.value(), response.getStatusCode());
|
||||
Assert.assertNotNull(response.getBody());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue