aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/utils/SZRGWClientUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/utils/SZRGWClientUtils.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/utils/SZRGWClientUtils.java399
1 files changed, 200 insertions, 199 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/utils/SZRGWClientUtils.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/utils/SZRGWClientUtils.java
index 4cca2e625..a9abc2c5f 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/utils/SZRGWClientUtils.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/client/utils/SZRGWClientUtils.java
@@ -1,199 +1,200 @@
-/*
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * 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.gv.egovernment.moa.id.client.utils;
-
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-import java.util.UUID;
-
-import org.opensaml.xml.util.XMLHelper;
-import org.w3c.dom.Element;
-
-import at.gv.egovernment.moa.id.client.SZRGWClient;
-import at.gv.egovernment.moa.id.client.SZRGWClientException;
-import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
-import at.gv.egovernment.moa.id.commons.api.ConnectionParameterInterface;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
-import at.gv.egovernment.moa.id.commons.api.exceptions.ConfigurationException;
-import at.gv.egovernment.moa.id.commons.utils.MOAIDMessageProvider;
-import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory;
-import at.gv.egovernment.moa.logging.Logger;
-import at.gv.egovernment.moa.util.MiscUtil;
-import at.gv.util.xsd.mis.MandateIdentifiers;
-import at.gv.util.xsd.mis.Target;
-import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest;
-import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest.PEPSData;
-import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse;
-import at.gv.util.xsd.srzgw.MISType;
-import at.gv.util.xsd.srzgw.MISType.Filters;
-
-/**
- * @author tlenz
- *
- */
-public class SZRGWClientUtils {
-
- /**
- * Does the request to the SZR-GW.
- *
- * @param signature the signature
- * @return the identity link
- * @throws SZRGWClientException the sZRGW client exception
- * @throws ConfigurationException the configuration exception
- */
- public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, Element signature) throws SZRGWClientException, ConfigurationException {
- return getIdentityLink(pendingReq, null, null, null, null, XMLHelper.nodeToString(signature), null);
- }
-
- /**
- * Does the request to the SZR-GW.
- *
- * @param PEPSIdentifier the pEPS identifier
- * @param PEPSFirstname the pEPS firstname
- * @param PEPSFamilyname the pEPS familyname
- * @param PEPSDateOfBirth the pEPS date of birth
- * @param signature XMLDSIG signature
- * @return Identity link assertion
- * @throws SZRGWClientException the sZRGW client exception
- * @throws ConfigurationException the configuration exception
- */
- public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature, String PEPSFiscalNumber) throws SZRGWClientException {
- return getIdentityLink(pendingReq, PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, null, signature, null, null, null, null, null, null, null, PEPSFiscalNumber);
- }
-
- /**
- * SZR-GW Client interface.
- *
- * @param eIdentifier the e identifier
- * @param givenName the given name
- * @param lastName the last name
- * @param dateOfBirth the date of birth
- * @param citizenSignature the citizen signature
- * @param representative the representative
- * @param represented the represented
- * @param mandate the mandate
- * @return the identity link
- * @throws SZRGWClientException the sZRGW client exception
- */
- public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, String eIdentifier,
- String givenName, String lastName, String dateOfBirth, String gender,
- String citizenSignature, String representative, String represented,
- String mandate, String targetType, String targetValue, String oaFriendlyName, List<String> filters, String PEPSFiscalNumber) throws SZRGWClientException {
- return getIdentityLink(pendingReq, eIdentifier, givenName, lastName, dateOfBirth, gender,
- citizenSignature, representative, represented, mandate, null,
- null, targetType, targetValue, oaFriendlyName, filters, PEPSFiscalNumber);
- }
-
- /**
- * Gets the identity link.
- *
- * @param citizenSignature the citizen signature
- * @param representative the representative
- * @param represented the represented
- * @param mandate the mandate
- * @param organizationAddress the organization address
- * @param organizationType the organization type
- * @return the identity link
- * @throws SZRGWClientException
- */
- public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, String citizenSignature,
- String representative, String represented, String mandateContent,
- String organizationAddress, String organizationType, String targetType, String targetValue, String oaFriendlyName, List<String> filters, String PEPSFiscalNumber) throws SZRGWClientException {
- return getIdentityLink(pendingReq, null, null, null, null, null,
- citizenSignature, represented, representative, mandateContent, organizationAddress,
- organizationType, targetType, targetValue, oaFriendlyName, filters, PEPSFiscalNumber);
- }
-
- public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String gender, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType, String targetType, String targetValue, String oaFriendlyName, List<String> filters, String PEPSFiscalNumber) throws SZRGWClientException {
-
- try {
- AuthConfiguration authConf = AuthConfigurationProviderFactory.getInstance();
- ConnectionParameterInterface connectionParameters = authConf.getForeignIDConnectionParameter(pendingReq.getOnlineApplicationConfiguration());
-
- String requestID = UUID.randomUUID().toString();
- SZRGWClient client = new SZRGWClient(connectionParameters);
-
- CreateIdentityLinkRequest request = new CreateIdentityLinkRequest();
- request.setSignature(citizenSignature.getBytes("UTF-8"));
- request.setReqID(requestID);
- if(PEPSDateOfBirth!=null || PEPSFamilyname!=null || PEPSFirstname!=null || PEPSIdentifier!=null || representative!=null || represented!=null || mandateContent!=null || organizationAddress!=null || organizationType!=null)
- {
- PEPSData data = new PEPSData();
- data.setDateOfBirth(PEPSDateOfBirth);
- data.setFamilyname(PEPSFamilyname);
- data.setFirstname(PEPSFirstname);
- data.setIdentifier(PEPSIdentifier);
-
- data.setFiscalNumber(PEPSFiscalNumber);
-
- data.setRepresentative(representative);
- data.setRepresented(represented);
- data.setMandateContent(mandateContent);
-
- data.setLegalPersonCanonicalRegisteredAddress(organizationAddress);
- data.setLegalPersonTranslatableType(organizationType);
-
- request.setPEPSData(data);
- }
- if (null != mandateContent) {
- MISType mis = new MISType();
-
- Target targetObject = new Target();
- targetObject.setType(targetType);
- targetObject.setValue(targetValue);
- mis.setTarget(targetObject);
-
- mis.setOAFriendlyName(oaFriendlyName);
-
- Filters filterObject = new Filters();
- MandateIdentifiers mandateIds = new MandateIdentifiers();
- for(String current : filters)
- mandateIds.getMandateIdentifier().add(current.trim());
- filterObject.setMandateIdentifiers(mandateIds);
- mis.setFilters(filterObject);
-
- request.setMIS(mis);
- }
-
- if (MiscUtil.isEmpty(connectionParameters.getUrl())) {
- Logger.warn("SZR-Gateway Service URL is empty");
- throw new SZRGWClientException("service.07");
- }
-
- Logger.info("Starte Kommunikation mit dem Stammzahlenregister Gateway(" + connectionParameters.getUrl() + ")...");
- CreateIdentityLinkResponse response = client.sentCreateIDLRequest(request, connectionParameters.getUrl());
- return response;
-
- }
- catch (ConfigurationException e) {
- Logger.warn(e);
- Logger.warn(MOAIDMessageProvider.getInstance().getMessage("config.12", null ));
- } catch (UnsupportedEncodingException e) {
- Logger.warn(e);
- }
-
- return null;
-
- }
-
-}
+///*
+// * Copyright 2014 Federal Chancellery Austria
+// * MOA-ID has been developed in a cooperation between BRZ, the Federal
+// * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+// *
+// * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+// * the European Commission - subsequent versions of the EUPL (the "Licence");
+// * You may not use this work except in compliance with the Licence.
+// * You may obtain a copy of the Licence at:
+// * http://www.osor.eu/eupl/
+// *
+// * Unless required by applicable law or agreed to in writing, software
+// * distributed under the Licence is distributed on an "AS IS" basis,
+// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// * See the Licence for the specific language governing permissions and
+// * limitations under the Licence.
+// *
+// * 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.gv.egovernment.moa.id.client.utils;
+//
+//import java.io.UnsupportedEncodingException;
+//import java.util.List;
+//import java.util.UUID;
+//
+//import org.opensaml.xml.util.XMLHelper;
+//import org.w3c.dom.Element;
+//
+//import at.gv.egiz.eaaf.core.api.IRequest;
+//import at.gv.egovernment.moa.id.client.SZRGWClient;
+//import at.gv.egovernment.moa.id.client.SZRGWClientException;
+//import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
+//import at.gv.egovernment.moa.id.commons.api.ConnectionParameterInterface;
+//import at.gv.egovernment.moa.id.commons.api.IOAAuthParameters;
+//import at.gv.egovernment.moa.id.commons.api.exceptions.ConfigurationException;
+//import at.gv.egovernment.moa.id.commons.utils.MOAIDMessageProvider;
+//import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory;
+//import at.gv.egovernment.moa.logging.Logger;
+//import at.gv.egovernment.moa.util.MiscUtil;
+//import at.gv.util.xsd.mis.MandateIdentifiers;
+//import at.gv.util.xsd.mis.Target;
+//import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest;
+//import at.gv.util.xsd.srzgw.CreateIdentityLinkRequest.PEPSData;
+//import at.gv.util.xsd.srzgw.CreateIdentityLinkResponse;
+//import at.gv.util.xsd.srzgw.MISType;
+//import at.gv.util.xsd.srzgw.MISType.Filters;
+//
+///**
+// * @author tlenz
+// *
+// */
+//public class SZRGWClientUtils {
+//
+// /**
+// * Does the request to the SZR-GW.
+// *
+// * @param signature the signature
+// * @return the identity link
+// * @throws SZRGWClientException the sZRGW client exception
+// * @throws ConfigurationException the configuration exception
+// */
+// public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, Element signature) throws SZRGWClientException, ConfigurationException {
+// return getIdentityLink(pendingReq, null, null, null, null, XMLHelper.nodeToString(signature), null);
+// }
+//
+// /**
+// * Does the request to the SZR-GW.
+// *
+// * @param PEPSIdentifier the pEPS identifier
+// * @param PEPSFirstname the pEPS firstname
+// * @param PEPSFamilyname the pEPS familyname
+// * @param PEPSDateOfBirth the pEPS date of birth
+// * @param signature XMLDSIG signature
+// * @return Identity link assertion
+// * @throws SZRGWClientException the sZRGW client exception
+// * @throws ConfigurationException the configuration exception
+// */
+// public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String signature, String PEPSFiscalNumber) throws SZRGWClientException {
+// return getIdentityLink(pendingReq, PEPSIdentifier, PEPSFirstname, PEPSFamilyname, PEPSDateOfBirth, null, signature, null, null, null, null, null, null, null, PEPSFiscalNumber);
+// }
+//
+// /**
+// * SZR-GW Client interface.
+// *
+// * @param eIdentifier the e identifier
+// * @param givenName the given name
+// * @param lastName the last name
+// * @param dateOfBirth the date of birth
+// * @param citizenSignature the citizen signature
+// * @param representative the representative
+// * @param represented the represented
+// * @param mandate the mandate
+// * @return the identity link
+// * @throws SZRGWClientException the sZRGW client exception
+// */
+// public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, String eIdentifier,
+// String givenName, String lastName, String dateOfBirth, String gender,
+// String citizenSignature, String representative, String represented,
+// String mandate, String targetType, String targetValue, String oaFriendlyName, List<String> filters, String PEPSFiscalNumber) throws SZRGWClientException {
+// return getIdentityLink(pendingReq, eIdentifier, givenName, lastName, dateOfBirth, gender,
+// citizenSignature, representative, represented, mandate, null,
+// null, targetType, targetValue, oaFriendlyName, filters, PEPSFiscalNumber);
+// }
+//
+// /**
+// * Gets the identity link.
+// *
+// * @param citizenSignature the citizen signature
+// * @param representative the representative
+// * @param represented the represented
+// * @param mandate the mandate
+// * @param organizationAddress the organization address
+// * @param organizationType the organization type
+// * @return the identity link
+// * @throws SZRGWClientException
+// */
+// public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, String citizenSignature,
+// String representative, String represented, String mandateContent,
+// String organizationAddress, String organizationType, String targetType, String targetValue, String oaFriendlyName, List<String> filters, String PEPSFiscalNumber) throws SZRGWClientException {
+// return getIdentityLink(pendingReq, null, null, null, null, null,
+// citizenSignature, represented, representative, mandateContent, organizationAddress,
+// organizationType, targetType, targetValue, oaFriendlyName, filters, PEPSFiscalNumber);
+// }
+//
+// public static CreateIdentityLinkResponse getIdentityLink(IRequest pendingReq, String PEPSIdentifier, String PEPSFirstname, String PEPSFamilyname, String PEPSDateOfBirth, String gender, String citizenSignature, String represented, String representative, String mandateContent, String organizationAddress, String organizationType, String targetType, String targetValue, String oaFriendlyName, List<String> filters, String PEPSFiscalNumber) throws SZRGWClientException {
+//
+// try {
+// AuthConfiguration authConf = AuthConfigurationProviderFactory.getInstance();
+// ConnectionParameterInterface connectionParameters = authConf.getForeignIDConnectionParameter(pendingReq.getServiceProviderConfiguration(IOAAuthParameters.class));
+//
+// String requestID = UUID.randomUUID().toString();
+// SZRGWClient client = new SZRGWClient(connectionParameters);
+//
+// CreateIdentityLinkRequest request = new CreateIdentityLinkRequest();
+// request.setSignature(citizenSignature.getBytes("UTF-8"));
+// request.setReqID(requestID);
+// if(PEPSDateOfBirth!=null || PEPSFamilyname!=null || PEPSFirstname!=null || PEPSIdentifier!=null || representative!=null || represented!=null || mandateContent!=null || organizationAddress!=null || organizationType!=null)
+// {
+// PEPSData data = new PEPSData();
+// data.setDateOfBirth(PEPSDateOfBirth);
+// data.setFamilyname(PEPSFamilyname);
+// data.setFirstname(PEPSFirstname);
+// data.setIdentifier(PEPSIdentifier);
+//
+// data.setFiscalNumber(PEPSFiscalNumber);
+//
+// data.setRepresentative(representative);
+// data.setRepresented(represented);
+// data.setMandateContent(mandateContent);
+//
+// data.setLegalPersonCanonicalRegisteredAddress(organizationAddress);
+// data.setLegalPersonTranslatableType(organizationType);
+//
+// request.setPEPSData(data);
+// }
+// if (null != mandateContent) {
+// MISType mis = new MISType();
+//
+// Target targetObject = new Target();
+// targetObject.setType(targetType);
+// targetObject.setValue(targetValue);
+// mis.setTarget(targetObject);
+//
+// mis.setOAFriendlyName(oaFriendlyName);
+//
+// Filters filterObject = new Filters();
+// MandateIdentifiers mandateIds = new MandateIdentifiers();
+// for(String current : filters)
+// mandateIds.getMandateIdentifier().add(current.trim());
+// filterObject.setMandateIdentifiers(mandateIds);
+// mis.setFilters(filterObject);
+//
+// request.setMIS(mis);
+// }
+//
+// if (MiscUtil.isEmpty(connectionParameters.getUrl())) {
+// Logger.warn("SZR-Gateway Service URL is empty");
+// throw new SZRGWClientException("service.07");
+// }
+//
+// Logger.info("Starte Kommunikation mit dem Stammzahlenregister Gateway(" + connectionParameters.getUrl() + ")...");
+// CreateIdentityLinkResponse response = client.sentCreateIDLRequest(request, connectionParameters.getUrl());
+// return response;
+//
+// }
+// catch (ConfigurationException e) {
+// Logger.warn(e);
+// Logger.warn(MOAIDMessageProvider.getInstance().getMessage("config.12", null ));
+// } catch (UnsupportedEncodingException e) {
+// Logger.warn(e);
+// }
+//
+// return null;
+//
+// }
+//
+//}