add cross origin config

This commit is contained in:
Efstratios Giannopoulos 2023-10-23 11:15:08 +03:00
parent 3ad7441bb5
commit 6cde8ae2a9
18 changed files with 28 additions and 29 deletions

View File

@ -1,4 +1,4 @@
package eu.eudat.service;
package eu.eudat.service.descriptiontemplatetype;
import eu.eudat.model.DescriptionTemplateType;
import eu.eudat.model.persist.DescriptionTemplateTypePersist;

View File

@ -1,4 +1,4 @@
package eu.eudat.service;
package eu.eudat.service.descriptiontemplatetype;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
@ -31,7 +31,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.context.annotation.RequestScope;
import javax.management.InvalidApplicationException;
import java.time.Instant;

View File

@ -1,4 +1,4 @@
package eu.eudat.service;
package eu.eudat.service.entitydoi;
import eu.eudat.model.DescriptionTemplateType;
import eu.eudat.model.EntityDoi;

View File

@ -1,4 +1,4 @@
package eu.eudat.service;
package eu.eudat.service.entitydoi;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
@ -6,20 +6,14 @@ import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.enums.EntityType;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateTypeEntity;
import eu.eudat.data.EntityDoiEntity;
import eu.eudat.data.old.DMP;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.DescriptionTemplateTypeTouchedEvent;
import eu.eudat.event.EntityDoiTouchedEvent;
import eu.eudat.event.EventBroker;
import eu.eudat.model.DescriptionTemplateType;
import eu.eudat.model.EntityDoi;
import eu.eudat.model.builder.DescriptionTemplateTypeBuilder;
import eu.eudat.model.builder.EntityDoiBuilder;
import eu.eudat.model.deleter.DescriptionTemplateTypeDeleter;
import eu.eudat.model.deleter.EntityDoiDeleter;
import eu.eudat.model.persist.DescriptionTemplateTypePersist;
import eu.eudat.model.persist.EntityDoiPersist;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.builder.BuilderFactory;
@ -38,14 +32,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.management.InvalidApplicationException;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@Service

View File

@ -191,6 +191,14 @@
<artifactId>saaj-impl</artifactId>
<version>3.0.0-M2</version>
</dependency>
<!--CITE DEPENDENCIES-->
<dependency>
<groupId>gr.cite</groupId>
<artifactId>cors-web</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
<build>

View File

@ -19,7 +19,7 @@ import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.helpers.responses.ResponseItem;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.service.DescriptionTemplateTypeService;
import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
import eu.eudat.types.ApiMessageCode;
import eu.eudat.types.MetricNames;
import gr.cite.commons.web.authz.service.AuthorizationService;
@ -37,9 +37,6 @@ import java.io.IOException;
import java.util.List;
import java.util.UUID;
import static eu.eudat.types.Authorities.ADMIN;
import static eu.eudat.types.Authorities.DATASET_PROFILE_MANAGER;
@RestController
@CrossOrigin
@RequestMapping(value = {"/api/admin/"})

View File

@ -10,7 +10,7 @@ import eu.eudat.model.persist.DescriptionTemplateTypePersist;
import eu.eudat.model.result.QueryResult;
import eu.eudat.query.DescriptionTemplateTypeQuery;
import eu.eudat.query.lookup.DescriptionTemplateTypeLookup;
import eu.eudat.service.DescriptionTemplateTypeService;
import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
import gr.cite.tools.auditing.AuditService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.censor.CensorFactory;
@ -32,7 +32,6 @@ import javax.management.InvalidApplicationException;
import java.util.*;
@RestController
@CrossOrigin
@RequestMapping(path = "api/description-template-type")
public class DescriptionTemplateTypeController {

View File

@ -30,7 +30,6 @@ import javax.management.InvalidApplicationException;
import java.util.*;
@RestController
@CrossOrigin
@RequestMapping(path = "api/dmp-blueprint")
public class DmpBlueprintController {

View File

@ -11,7 +11,7 @@ import eu.eudat.model.persist.EntityDoiPersist;
import eu.eudat.model.result.QueryResult;
import eu.eudat.query.EntityDoiQuery;
import eu.eudat.query.lookup.EntityDoiLookup;
import eu.eudat.service.EntityDoiService;
import eu.eudat.service.entitydoi.EntityDoiService;
import gr.cite.tools.auditing.AuditService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.censor.CensorFactory;
@ -33,7 +33,6 @@ import javax.management.InvalidApplicationException;
import java.util.*;
@RestController
@CrossOrigin
@RequestMapping(path = "api/entity-doi")
public class EntityDoiController {

View File

@ -28,7 +28,6 @@ import javax.management.InvalidApplicationException;
import java.util.List;
@RestController
@CrossOrigin
@RequestMapping(path = {"api/external-references"})
public class ExternalReferencesController extends BaseController {

View File

@ -15,7 +15,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
@CrossOrigin
@RequestMapping(path = {"api/validation"})
public class ExternalValidationController extends BaseController {

View File

@ -21,7 +21,6 @@ import eu.eudat.models.v2.Account;
import javax.management.InvalidApplicationException;
@RestController
@CrossOrigin
@RequestMapping(value = { "/api/principal/" })
public class PrincipalController {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PrincipalController.class));

View File

@ -25,7 +25,6 @@ import java.util.stream.Stream;
import static eu.eudat.types.Authorities.ADMIN;
@RestController
@CrossOrigin
@RequestMapping(path = {"/api/material"})
public class SupportiveMaterialController {

View File

@ -11,7 +11,7 @@ import eu.eudat.models.data.admin.composite.DatasetProfile;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.utilities.builders.ModelBuilder;
import eu.eudat.commons.types.xml.XmlBuilder;
import eu.eudat.service.DescriptionTemplateTypeService;
import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

View File

@ -29,7 +29,7 @@ import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import eu.eudat.models.data.mail.SimpleMail;
import eu.eudat.queryable.QueryableList;
import eu.eudat.service.DescriptionTemplateTypeService;
import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
import eu.eudat.types.MetricNames;
import gr.cite.commons.web.authz.service.AuthorizationService;
import org.slf4j.Logger;

View File

@ -15,5 +15,6 @@ spring:
optional:classpath:config/file-path.yml[.yml], optional:classpath:config/file-path-${spring.profiles.active}.yml[.yml], optional:file:../config/file-path-${spring.profiles.active}.yml[.yml],
optional:classpath:config/idpclaims.yml[.yml], optional:classpath:config/idpclaims-${spring.profiles.active}.yml[.yml], optional:file:../config/idpclaims-${spring.profiles.active}.yml[.yml],
optional:classpath:config/external.yml[.yml], optional:classpath:config/external-${spring.profiles.active}.yml[.yml], optional:file:../config/external-${spring.profiles.active}.yml[.yml],
optional:classpath:config/cors.yml[.yml], optional:classpath:config/cors-${spring.profiles.active}.yml[.yml], optional:file:../config/cors-${spring.profiles.active}.yml[.yml],
optional:classpath:config/swagger.yml[.yml], optional:classpath:config/swagger-${spring.profiles.active}.yml[.yml], optional:file:../config/swagger-${spring.profiles.active}.yml[.yml],
optional:classpath:config/deposit.yml[.yml], optional:classpath:config/deposit-${spring.profiles.active}.yml[.yml], optional:file:../config/deposit-${spring.profiles.active}.yml[.yml]

View File

@ -0,0 +1,3 @@
web:
cors:
allowed-origins: [ http://localhost, http://localhost:4200 ]

View File

@ -0,0 +1,7 @@
web:
cors:
enabled: true
allowed-methods: [ HEAD, GET, POST, PUT, DELETE, PATCH ]
allowed-headers: [ Authorization, Cache-Control, Content-Type, Content-Disposition, x-tenant ]
exposed-headers: [ Authorization, Cache-Control, Content-Type, Content-Disposition ]
allow-credentials: false