Commit 79a91c7f authored by Noel Alonso's avatar Noel Alonso
Browse files

Merge branch 'dev' into 'master'

Dev

See merge request redmic-project/server/user!16
parents 4503174e 32172816
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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>
	
+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");
	}
}
+3 −5
Original line number Diff line number Diff line
@@ -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()
@@ -80,5 +79,4 @@ public class Oauth2SecurityConfiguration {
					"#oauth2.hasScope('read') or #oauth2.hasScope('write') and hasAnyRole('ROLE_ADMINISTRATOR', 'ROLE_OAG', 'ROLE_COLLABORATOR', 'ROLE_USER')");
		}
	}

}