Fixing CORS issue
This commit is contained in:
committed by
Petri Tuomola
parent
2b57bf379e
commit
aacb28b131
+4
-2
@@ -68,8 +68,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
|
|
||||||
http.antMatcher("/api/**").csrf().disable() //
|
http //
|
||||||
.authorizeRequests() //
|
.csrf().disable() //
|
||||||
|
.antMatcher("/api/**").authorizeRequests() //
|
||||||
|
.antMatchers(HttpMethod.OPTIONS, "/api/**").permitAll() //
|
||||||
.antMatchers(HttpMethod.POST, "/api/*/echo").permitAll() //
|
.antMatchers(HttpMethod.POST, "/api/*/echo").permitAll() //
|
||||||
.antMatchers(HttpMethod.POST, "/api/*/authentication").permitAll() //
|
.antMatchers(HttpMethod.POST, "/api/*/authentication").permitAll() //
|
||||||
.antMatchers(HttpMethod.POST, "/api/*/self/authentication").permitAll() //
|
.antMatchers(HttpMethod.POST, "/api/*/self/authentication").permitAll() //
|
||||||
|
|||||||
+4
@@ -22,6 +22,8 @@ import javax.ws.rs.container.ContainerRequestContext;
|
|||||||
import javax.ws.rs.container.ContainerResponseContext;
|
import javax.ws.rs.container.ContainerResponseContext;
|
||||||
import javax.ws.rs.container.ContainerResponseFilter;
|
import javax.ws.rs.container.ContainerResponseFilter;
|
||||||
import javax.ws.rs.ext.Provider;
|
import javax.ws.rs.ext.Provider;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,6 +32,8 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Provider
|
@Provider
|
||||||
|
@Component
|
||||||
|
@Scope("singleton")
|
||||||
public class ResponseCorsFilter implements ContainerResponseFilter {
|
public class ResponseCorsFilter implements ContainerResponseFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user