Added some endpoints not protected
This commit is contained in:
@ -2,7 +2,6 @@ package com.plannaplan.security;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
@ -37,7 +36,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void configure(final WebSecurity webSecurity) {
|
||||
webSecurity.ignoring().antMatchers("/token**");
|
||||
webSecurity.ignoring().antMatchers("/token**").antMatchers("/api/v1/courses/getCourses")
|
||||
.antMatchers("/api/v1/groups/getCourseGroups").antMatchers("/api/v1/courses/getCoursesWithGroups");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,15 +46,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().exceptionHandling().and()
|
||||
.authenticationProvider(provider)
|
||||
.addFilterBefore(authenticationFilter(), AnonymousAuthenticationFilter.class).authorizeRequests()
|
||||
.antMatchers(HttpMethod.GET, "/token**").permitAll().anyRequest().authenticated();
|
||||
.anyRequest().authenticated();
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
AuthenticationFilter authenticationFilter() throws Exception {
|
||||
final AuthenticationFilter filter = new AuthenticationFilter(PROTECTED_URLS);
|
||||
filter.setAuthenticationManager(authenticationManager());
|
||||
// filter.setAuthenticationSuccessHandler(successHandler());
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user