From 5a2c2f712e61960afd301999f964cdfcbe11ab41 Mon Sep 17 00:00:00 2001 From: Miguel Reboiro-Jato Date: Mon, 10 Feb 2020 19:52:41 +0100 Subject: [PATCH] Adds CORS configuration to the REST API The REST API now supports cross-origin requests thanks to a new CORS configuration. --- pom.xml | 2 +- src/main/webapp/WEB-INF/web.xml | 117 +++++++++++++++++++------------- 2 files changed, 69 insertions(+), 50 deletions(-) diff --git a/pom.xml b/pom.xml index 49e84c2..ccf5f97 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ es.uvigo.esei.daa example war - 0.1.12 + 0.1.13 DAA Example diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index df238ce..f748eff 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -1,56 +1,75 @@ - DAAExample + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee + http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" + version="3.1"> + DAAExample - - index.html - + + index.html + - - - Protected Area - /rest/* - PUT - DELETE - GET - POST - OPTIONS - - - ADMIN - USER - - + + CorsFilter + org.apache.catalina.filters.CorsFilter + + cors.allowed.origins + * + + + cors.allowed.headers + Authorization + + + cors.allowed.methods + GET, POST, DELETE, PUT + + + + CorsFilter + /rest/* + - - - Admin Area - /rest/people/* - PUT - DELETE - GET - POST - OPTIONS - - - ADMIN - - + + + Protected Area + /rest/* + PUT + DELETE + GET + POST + + + ADMIN + USER + + - - - ADMIN - - - USER - - - - BASIC - DAAExample - + + + Admin Area + /rest/people/* + GET + PUT + DELETE + POST + + + ADMIN + + + + + + ADMIN + + + USER + + + + BASIC + DAAExample + \ No newline at end of file -- 2.18.1