aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/CCSpecificEIDProcessingService.java
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/CCSpecificEIDProcessingService.java')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/CCSpecificEIDProcessingService.java131
1 files changed, 0 insertions, 131 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/CCSpecificEIDProcessingService.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/CCSpecificEIDProcessingService.java
deleted file mode 100644
index 602982d6..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/CCSpecificEIDProcessingService.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.annotation.PostConstruct;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.DAO.ERnBeIDData;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAttributeException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDPostProcessingException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.handler.INationaleIDProcessor;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils;
-import at.gv.egiz.eaaf.core.api.IRequest;
-import at.gv.egiz.eaaf.core.impl.data.Trible;
-import eu.eidas.auth.commons.light.impl.LightRequest.Builder;
-
-@Service
-public class CCSpecificEIDProcessingService implements ICCSpecificEIDProcessingService{
- private static final Logger log = LoggerFactory.getLogger(CCSpecificEIDProcessingService.class);
-
- @Autowired private ApplicationContext context;
-
- private List<INationaleIDProcessor> handlers = new ArrayList<INationaleIDProcessor>();
-
- @PostConstruct
- private void initialize() {
- log.debug("Initialize eID PostProcessing-Service ... ");
- Map<String, INationaleIDProcessor> postProcessors = context.getBeansOfType(INationaleIDProcessor.class);
- Iterator<Entry<String, INationaleIDProcessor>> iterator = postProcessors.entrySet().iterator();
- while (iterator.hasNext()) {
- Entry<String, INationaleIDProcessor> el = iterator.next();
- log.debug("Find eID-PostProcessor with name: " + el.getKey());
- handlers.add(el.getValue());
-
- }
-
- log.trace("Sorting eID-PostProcessors on priority ... ");
- Collections.sort(handlers, new Comparator<INationaleIDProcessor>() {
- @Override
- public int compare(INationaleIDProcessor thisAuthModule, INationaleIDProcessor otherAuthModule) {
- int thisOrder = thisAuthModule.getPriority();
- int otherOrder = otherAuthModule.getPriority();
- return (thisOrder < otherOrder ? 1 : (thisOrder == otherOrder ? 0 : -1));
- }
- });
-
- log.info("# " + handlers.size() + " eID PostProcessing services are registrated");
-
- }
-
- @Override
- public void preProcess(String selectedCitizenCountry, IRequest pendingReq, Builder authnRequestBuilder) throws eIDPostProcessingException {
- if (StringUtils.isEmpty(selectedCitizenCountry))
- log.info("No CountryCode for eID Pre-Processor. Default Pre-Processor will be used");
-
- for (INationaleIDProcessor el : handlers) {
- if (el.canHandle(selectedCitizenCountry)) {
- log.debug("Pre-Process eIDAS request for " + selectedCitizenCountry + " by using: " + el.getName());
- el.preProcess(pendingReq, authnRequestBuilder);
- return;
-
- }
- }
-
- log.error("NO eID PostProcessor FOUND. Looks like a depentency problem!");
- throw new eIDPostProcessingException("internal.00", null);
-
- }
-
- @Override
- public ERnBeIDData postProcess(Map<String, Object> eIDASAttrMap) throws eIDPostProcessingException, eIDASAttributeException {
- //extract citizen country from eIDAS unique identifier
- Object eIdentifierObj = eIDASAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
- if (eIdentifierObj == null || !(eIdentifierObj instanceof String))
- throw new eIDASAttributeException(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
-
- Trible<String, String, String> eIdentifier =
- eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIdentifierObj);
- String citizenCountry = eIdentifier.getFirst();
-
- if (StringUtils.isEmpty(citizenCountry))
- log.info("No CountryCode for eID PostProcessor. Default-PostProcessor will be used");
-
- for (INationaleIDProcessor el : handlers) {
- if (el.canHandle(citizenCountry)) {
- log.debug("Post-Process eIDAS eID from " + citizenCountry + " by using: " + el.getName());
- return el.postProcess(eIDASAttrMap);
-
- }
- }
-
- log.error("NO eID PostProcessor FOUND. Looks like a depentency problem!");
- throw new eIDPostProcessingException("internal.00", null);
- }
-
-}