aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java97
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java4
2 files changed, 34 insertions, 67 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java
index 0f3c1281..b105eb82 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthMetadataController.java
@@ -1,33 +1,20 @@
package at.asitplus.eidas.specific.modules.auth.eidas.v2.idaustriaclient;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import at.gv.egiz.eaaf.core.exceptions.EaafAuthenticationException;
import at.gv.egiz.eaaf.core.exceptions.EaafException;
-import at.gv.egiz.eaaf.core.impl.data.Pair;
-import at.gv.egiz.eaaf.core.impl.http.HttpUtils;
import at.gv.egiz.eaaf.core.impl.idp.controller.AbstractController;
-import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egiz.eaaf.modules.pvp2.api.IPvp2BasicConfiguration;
import at.gv.egiz.eaaf.modules.pvp2.impl.builder.PvpMetadataBuilder;
-
-import org.apache.commons.lang3.StringUtils;
+import com.google.common.net.MediaType;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
-import com.google.common.net.MediaType;
-import lombok.extern.slf4j.Slf4j;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
/**
* Controller that generates SAML2 metadata for eIDAS authentication client.
@@ -39,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;
@Controller
public class IdAustriaClientAuthMetadataController extends AbstractController {
- private static final String ERROR_CODE_INTERNAL_00 = "eaaf.core.00";
+ //private static final String ERROR_CODE_INTERNAL_00 = "eaaf.core.00";
@Autowired
PvpMetadataBuilder metadatabuilder;
@@ -74,12 +61,12 @@ public class IdAustriaClientAuthMetadataController extends AbstractController {
EaafException {
// check PublicURL prefix
try {
- final String authUrl = getAuthUrlFromHttpContext(req);
+ final String authUrl = "https://eid.egiz.gv.at/idp/shibboleth";//TODO load from config
// initialize metadata builder configuration
final IdAustriaClientAuthMetadataConfiguration metadataConfig =
new IdAustriaClientAuthMetadataConfiguration(authUrl, credentialProvider, pvpConfiguration);
- metadataConfig.setAdditionalRequiredAttributes(getAdditionalRequiredAttributes());
+ // metadataConfig.setAdditionalRequiredAttributes(getAdditionalRequiredAttributes());
// build metadata
final String xmlMetadata = metadatabuilder.buildPvpMetadata(metadataConfig);
@@ -99,51 +86,29 @@ public class IdAustriaClientAuthMetadataController extends AbstractController {
}
- private String getAuthUrlFromHttpContext(HttpServletRequest req) throws EaafException {
- // check if End-Point is valid
- final String authUrlString = HttpUtils.extractAuthUrlFromRequest(req);
- URL authReqUrl;
- try {
- authReqUrl = new URL(authUrlString);
-
- } catch (final MalformedURLException e) {
- log.warn("Requested URL: {} is not a valid URL.", authUrlString);
- throw new EaafAuthenticationException(ERROR_CODE_INTERNAL_00, new Object[] { authUrlString }, e);
-
- }
- //TODO remove
- final String idpAuthUrl = authConfig.validateIdpUrl(authReqUrl);
- if (idpAuthUrl == null) {
- log.warn("Requested URL: {} is NOT found in configuration.", authReqUrl);
- throw new EaafAuthenticationException(ERROR_CODE_INTERNAL_00, new Object[] { authUrlString });
-
- }
- return idpAuthUrl;
- }
-
- private List<Pair<String, Boolean>> getAdditionalRequiredAttributes() {
- final List<Pair<String, Boolean>> result = new ArrayList<>();
-
- // load attributes from configuration
- final Map<String, String> addReqAttributes = authConfig.getBasicConfigurationWithPrefix(
- IdAustriaClientAuthConstants.CONFIG_PROPS_REQUIRED_PVP_ATTRIBUTES_LIST);
- for (final String el : addReqAttributes.values()) {
- if (StringUtils.isNotEmpty(el)) {
- log.trace("Parse additional attr. definition: " + el);
- final List<String> attr = KeyValueUtils.getListOfCsvValues(el.trim());
- if (attr.size() == 2) {
- result.add(Pair.newInstance(attr.get(0), Boolean.parseBoolean(attr.get(1))));
-
- } else {
- log.info("IGNORE additional attr. definition: " + el
- + " Reason: Format not valid");
- }
- }
- }
-
- return result;
-
- }
+ // private List<Pair<String, Boolean>> getAdditionalRequiredAttributes() {
+ // final List<Pair<String, Boolean>> result = new ArrayList<>();
+ //
+ // // load attributes from configuration
+ // final Map<String, String> addReqAttributes = authConfig.getBasicConfigurationWithPrefix(
+ // IdAustriaClientAuthConstants.CONFIG_PROPS_REQUIRED_PVP_ATTRIBUTES_LIST);
+ // for (final String el : addReqAttributes.values()) {
+ // if (StringUtils.isNotEmpty(el)) {
+ // log.trace("Parse additional attr. definition: " + el);
+ // final List<String> attr = KeyValueUtils.getListOfCsvValues(el.trim());
+ // if (attr.size() == 2) {
+ // result.add(Pair.newInstance(attr.get(0), Boolean.parseBoolean(attr.get(1))));
+ //
+ // } else {
+ // log.info("IGNORE additional attr. definition: " + el
+ // + " Reason: Format not valid");
+ // }
+ // }
+ // }
+ //
+ // return result;
+ //
+ // }
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java
index af1ef6f7..76f78a78 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java
@@ -83,7 +83,8 @@ public class GenerateMobilePhoneSignatureRequestTask extends AbstractAuthServlet
//step 15a
// get entityID for ms-specific eIDAS node
- final String msNodeEntityID = "TODO";
+ //TODO load from config
+ final String msNodeEntityID = "classpath:/data/idp_metadata_classpath_entity.xml";
if (StringUtils.isEmpty(msNodeEntityID)) {
log.info("eIDAS authentication not possible -> NO EntityID for central eIDAS node FOUND!");
@@ -130,6 +131,7 @@ public class GenerateMobilePhoneSignatureRequestTask extends AbstractAuthServlet
//TODO
} catch (final Exception e) {
+ e.printStackTrace();
log.error("Initial search FAILED.", e);
throw new TaskExecutionException(pendingReq, "Initial search FAILED.", e);
}