Loading pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>user</artifactId> <packaging>jar</packaging> <version>0.8.0</version> <version>0.9.0</version> <name>User</name> <description>Account management and user services</description> Loading src/main/java/es/redmic/user/config/CorsConfiguration.java 0 → 100644 +14 −0 Original line number Diff line number Diff line package es.redmic.user.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class CorsConfiguration implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").allowedMethods("GET", "PUT", "POST", "DELETE"); } } src/main/java/es/redmic/user/config/Oauth2SecurityConfiguration.java +3 −5 Original line number Diff line number Diff line Loading @@ -59,15 +59,14 @@ public class Oauth2SecurityConfiguration { @Override public void configure(ResourceServerSecurityConfigurer resources) { resources.tokenServices(tokenService()) .resourceId(SPARKLR_RESOURCE_ID); resources.tokenServices(tokenService()).resourceId(SPARKLR_RESOURCE_ID); } @Override public void configure(HttpSecurity http) throws Exception { // @formatter:off http.anonymous().and().authorizeRequests().antMatchers("/user/actuator/**").permitAll() http.cors().and().anonymous().and().authorizeRequests().antMatchers("/user/actuator/**").permitAll() .antMatchers(HttpMethod.GET, "/user/profile/").permitAll() .antMatchers(HttpMethod.GET, "/user/modules/openmodules/").permitAll() .antMatchers(HttpMethod.POST, "/user/register/**/").permitAll() Loading @@ -80,5 +79,4 @@ public class Oauth2SecurityConfiguration { "#oauth2.hasScope('read') or #oauth2.hasScope('write') and hasAnyRole('ROLE_ADMINISTRATOR', 'ROLE_OAG', 'ROLE_COLLABORATOR', 'ROLE_USER')"); } } } Loading
pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>user</artifactId> <packaging>jar</packaging> <version>0.8.0</version> <version>0.9.0</version> <name>User</name> <description>Account management and user services</description> Loading
src/main/java/es/redmic/user/config/CorsConfiguration.java 0 → 100644 +14 −0 Original line number Diff line number Diff line package es.redmic.user.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class CorsConfiguration implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").allowedMethods("GET", "PUT", "POST", "DELETE"); } }
src/main/java/es/redmic/user/config/Oauth2SecurityConfiguration.java +3 −5 Original line number Diff line number Diff line Loading @@ -59,15 +59,14 @@ public class Oauth2SecurityConfiguration { @Override public void configure(ResourceServerSecurityConfigurer resources) { resources.tokenServices(tokenService()) .resourceId(SPARKLR_RESOURCE_ID); resources.tokenServices(tokenService()).resourceId(SPARKLR_RESOURCE_ID); } @Override public void configure(HttpSecurity http) throws Exception { // @formatter:off http.anonymous().and().authorizeRequests().antMatchers("/user/actuator/**").permitAll() http.cors().and().anonymous().and().authorizeRequests().antMatchers("/user/actuator/**").permitAll() .antMatchers(HttpMethod.GET, "/user/profile/").permitAll() .antMatchers(HttpMethod.GET, "/user/modules/openmodules/").permitAll() .antMatchers(HttpMethod.POST, "/user/register/**/").permitAll() Loading @@ -80,5 +79,4 @@ public class Oauth2SecurityConfiguration { "#oauth2.hasScope('read') or #oauth2.hasScope('write') and hasAnyRole('ROLE_ADMINISTRATOR', 'ROLE_OAG', 'ROLE_COLLABORATOR', 'ROLE_USER')"); } } }