aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-AT_eIDAS_connector
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/modules/moa-id-module-AT_eIDAS_connector')
-rw-r--r--id/server/modules/moa-id-module-AT_eIDAS_connector/pom.xml2
-rw-r--r--id/server/modules/moa-id-module-AT_eIDAS_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eIDAScentralAuth/controller/EidasCentralAuthMetadataController.java40
2 files changed, 20 insertions, 22 deletions
diff --git a/id/server/modules/moa-id-module-AT_eIDAS_connector/pom.xml b/id/server/modules/moa-id-module-AT_eIDAS_connector/pom.xml
index 27acb2223..aad4f2919 100644
--- a/id/server/modules/moa-id-module-AT_eIDAS_connector/pom.xml
+++ b/id/server/modules/moa-id-module-AT_eIDAS_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-AT_eIDAS_connector</artifactId>
<name>moa-id-module-AT_eIDAS_connector</name>
diff --git a/id/server/modules/moa-id-module-AT_eIDAS_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eIDAScentralAuth/controller/EidasCentralAuthMetadataController.java b/id/server/modules/moa-id-module-AT_eIDAS_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eIDAScentralAuth/controller/EidasCentralAuthMetadataController.java
index a0c1fa30b..5409e3a4c 100644
--- a/id/server/modules/moa-id-module-AT_eIDAS_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eIDAScentralAuth/controller/EidasCentralAuthMetadataController.java
+++ b/id/server/modules/moa-id-module-AT_eIDAS_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eIDAScentralAuth/controller/EidasCentralAuthMetadataController.java
@@ -23,6 +23,7 @@
package at.gv.egovernment.moa.id.auth.modules.eIDAScentralAuth.controller;
import java.io.IOException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -76,29 +77,26 @@ public class EidasCentralAuthMetadataController 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
- EidasCentralAuthMetadataConfiguration metadataConfig =
- new EidasCentralAuthMetadataConfiguration(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());
+ String authUrlString = HTTPUtils.extractAuthURLFromRequest(req);
+ String authURL = authConfig.validateIDPURL(new URL(authUrlString));
+ Logger.trace("Build eIDAS Metadata for requestUrl: " + authURL);
+
+ //initialize metadata builder configuration
+ EidasCentralAuthMetadataConfiguration metadataConfig =
+ new EidasCentralAuthMetadataConfiguration(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 federated-authentication PVP metadata FAILED.", e);