diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2020-08-31 16:31:24 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2020-08-31 16:31:24 +0200 |
commit | 58db610bd0abd302e9886bc5f388af158fa295d2 (patch) | |
tree | c5989cc7c4f72726df1d69440385cd548f648bfa /id/server/modules/moa-id-module-E-ID_connector | |
parent | e9fa374738cf1bbc84b36c50bba898892d2c1688 (diff) | |
parent | efeae1c1b91823ea4a7d4c84f3c1721f0a06e628 (diff) | |
download | moa-id-spss-58db610bd0abd302e9886bc5f388af158fa295d2.tar.gz moa-id-spss-58db610bd0abd302e9886bc5f388af158fa295d2.tar.bz2 moa-id-spss-58db610bd0abd302e9886bc5f388af158fa295d2.zip |
Merge branch 'development_preview'
Diffstat (limited to 'id/server/modules/moa-id-module-E-ID_connector')
2 files changed, 20 insertions, 23 deletions
diff --git a/id/server/modules/moa-id-module-E-ID_connector/pom.xml b/id/server/modules/moa-id-module-E-ID_connector/pom.xml index ac73237ae..e5cf307ab 100644 --- a/id/server/modules/moa-id-module-E-ID_connector/pom.xml +++ b/id/server/modules/moa-id-module-E-ID_connector/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>MOA.id.server.modules</groupId> <artifactId>moa-id-modules</artifactId> - <version>4.1.2</version> + <version>4.1.3</version> </parent> <artifactId>moa-id-module-EID_connector</artifactId> <name>moa-id-module-E-ID_connector</name> diff --git a/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/controller/EIDAuthMetadataController.java b/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/controller/EIDAuthMetadataController.java index 90ecb0942..9fbe04b98 100644 --- a/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/controller/EIDAuthMetadataController.java +++ b/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/controller/EIDAuthMetadataController.java @@ -23,6 +23,7 @@ package at.gv.egovernment.moa.id.auth.modules.eidproxyauth.controller; import java.io.IOException; +import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -76,28 +77,24 @@ public class EIDAuthMetadataController extends AbstractController { public void getSPMetadata(HttpServletRequest req, HttpServletResponse resp) throws IOException, EAAFException { //check PublicURL prefix try { - String authURL = HTTPUtils.extractAuthURLFromRequest(req); - if (!authConfig.getPublicURLPrefix().contains(authURL)) { - resp.sendError(HttpServletResponse.SC_FORBIDDEN, "No valid request URL"); - return; - - } else { - //initialize metadata builder configuration - EIDAuthMetadataConfiguration metadataConfig = - new EIDAuthMetadataConfiguration(authURL, credentialProvider, pvpConfiguration); - metadataConfig.setAdditionalRequiredAttributes(getAdditonalRequiredAttributes()); - - //build metadata - String xmlMetadata = metadatabuilder.buildPVPMetadata(metadataConfig); - - //write response - byte[] content = xmlMetadata.getBytes("UTF-8"); - resp.setStatus(HttpServletResponse.SC_OK); - resp.setContentLength(content.length); - resp.setContentType(MediaType.XML_UTF_8.toString()); - resp.getOutputStream().write(content); - - } + String authUrlString = HTTPUtils.extractAuthURLFromRequest(req); + String authURL = authConfig.validateIDPURL(new URL(authUrlString)); + Logger.trace("Build E-ID Metadata for requestUrl: " + authURL); + + //initialize metadata builder configuration + EIDAuthMetadataConfiguration metadataConfig = + new EIDAuthMetadataConfiguration(authURL, credentialProvider, pvpConfiguration); + metadataConfig.setAdditionalRequiredAttributes(getAdditonalRequiredAttributes()); + + //build metadata + String xmlMetadata = metadatabuilder.buildPVPMetadata(metadataConfig); + + //write response + byte[] content = xmlMetadata.getBytes("UTF-8"); + resp.setStatus(HttpServletResponse.SC_OK); + resp.setContentLength(content.length); + resp.setContentType(MediaType.XML_UTF_8.toString()); + resp.getOutputStream().write(content); } catch (Exception e) { Logger.warn("Build E-ID Proxy PVP metadata FAILED.", e); |