From 65e3da74f60e7dadd6e342e0b3106b2519a20e51 Mon Sep 17 00:00:00 2001 From: Bojan Suzic Date: Thu, 3 Apr 2014 17:21:30 +0200 Subject: removing storkservice config --- .../id/configuration/data/oa/OAGeneralConfig.java | 31 ++--------- .../struts/action/EditGeneralConfigAction.java | 2 - .../configuration/struts/action/EditOAAction.java | 62 +++++----------------- .../validation/oa/OAGeneralConfigValidation.java | 17 +----- id/ConfigWebTool/src/main/webapp/js/common.js | 18 ------- .../src/main/webapp/jsp/editOAGeneral.jsp | 24 +-------- .../moa/id/auth/AuthenticationServer.java | 9 +--- .../moa/id/auth/builder/BPKBuilder.java | 31 +++++++---- .../StartAuthentificationParameterParser.java | 4 +- .../gv/egovernment/moa/id/config/OAParameter.java | 15 +----- .../stork2/EHvdAttributeProviderPlugin.java | 2 +- .../id/protocols/stork2/MOAAttributeProvider.java | 2 +- 12 files changed, 45 insertions(+), 172 deletions(-) (limited to 'id') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java index 7510b8932..d43c97aed 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java @@ -59,7 +59,6 @@ public class OAGeneralConfig { private String friendlyName = null; private boolean businessService = false; - private boolean storkService = false; private String target = null; private String target_subsector = null; @@ -71,8 +70,7 @@ public class OAGeneralConfig { private String identificationNumber = null; private String identificationType = null; private static List identificationTypeList = null; - private String storkSPTargetCountry = null; - + private String aditionalAuthBlockText = null; private String mandateProfiles = null; @@ -164,14 +162,6 @@ public class OAGeneralConfig { else businessService = false; - if (dbOAConfig.getType().equals(Constants.MOA_CONFIG_STORKSERVICE)) - storkService = true; - else - storkService = false; - - if (dbOAConfig.getStorkSPTargetCountry() != null) - storkSPTargetCountry = dbOAConfig.getStorkSPTargetCountry(); - AuthComponentOA oaauth = dbOAConfig.getAuthComponentOA(); if (oaauth != null) { @@ -219,7 +209,8 @@ public class OAGeneralConfig { identificationType = split[1]; identificationNumber = split[2]; } else if (Constants.PREFIX_STORK.startsWith(split[0]) && split.length >= 2) { - identificationType = split[1]; // setting at as iden category ? + //identificationType = split[1]; // setting at as iden category ? + identificationType = Constants.IDENIFICATIONTYPE_STORK; identificationNumber = split[2]; // setting sp country as ident type -> sp ident } } @@ -334,14 +325,6 @@ public class OAGeneralConfig { return identificationNumber; } - public String getStorkSPTargetCountry() { - return storkSPTargetCountry; - } - - public void setStorkSPTargetCountry(String storkSPTargetCountry) { - this.storkSPTargetCountry = storkSPTargetCountry; - } - public void setIdentificationNumber(String identificationNumber) { this.identificationNumber = identificationNumber; } @@ -382,14 +365,6 @@ public class OAGeneralConfig { return businessService; } - public boolean isStorkService() { - return storkService; - } - - public void setStorkService(boolean storkService) { - this.storkService = storkService; - } - public void setBusinessService(boolean businessService) { this.businessService = businessService; } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index b2bf58f1a..cb3a2a1ff 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -667,7 +667,6 @@ public class EditGeneralConfigAction extends BasicAction { */ public void setMoaconfig(GeneralMOAIDConfig moaconfig) { this.moaconfig = moaconfig; - log.error("MOA CONFIG SET"); } /** @@ -686,7 +685,6 @@ public class EditGeneralConfigAction extends BasicAction { */ public void setStorkconfig(GeneralStorkConfig storkconfig) { this.storkconfig = storkconfig; - log.error("STORK CONFIG SET"); } /** diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index 4830ffb71..cc2cf3bf0 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -68,10 +68,8 @@ public class EditOAAction extends BasicAction { private String formID; private boolean onlyBusinessService = false; - private boolean onlyStorkService = false; private boolean subTargetSet = false; private boolean deaktivededBusinessService = false; - private boolean deactivatedStorkService = false; private boolean isMetaDataRefreshRequired = false; private String nextPage; @@ -736,18 +734,7 @@ public class EditOAAction extends BasicAction { dboa.setPublicURLPrefix(generalOA.getIdentifier()); - if (generalOA.isStorkService() || onlyStorkService) { - dboa.setType(Constants.MOA_CONFIG_STORKSERVICE); - dboa.setStorkSPTargetCountry(generalOA.getStorkSPTargetCountry()); - - - IdentificationNumber idnumber = new IdentificationNumber(); - idnumber.setValue(Constants.PREFIX_STORK + "AT+" + generalOA.getStorkSPTargetCountry()); - idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType())); - - authoa.setIdentificationNumber(idnumber); - - } else if (generalOA.isBusinessService() || onlyBusinessService) { + if (generalOA.isBusinessService() || onlyBusinessService) { dboa.setType(Constants.MOA_CONFIG_BUSINESSSERVICE); @@ -767,8 +754,15 @@ public class EditOAAction extends BasicAction { num = num.substring(Constants.IDENIFICATIONTYPE_ERSB.length()); IdentificationNumber idnumber = new IdentificationNumber(); - idnumber.setValue(Constants.PREFIX_WPBK + generalOA.getIdentificationType() + "+" + num); - idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType())); + + if (generalOA.getIdentificationType().equals(Constants.IDENIFICATIONTYPE_STORK)) { + idnumber.setValue(Constants.PREFIX_STORK + "AT" + "+" + num); + idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType())); + } else { + idnumber.setValue(Constants.PREFIX_WPBK + generalOA.getIdentificationType() + "+" + num); + idnumber.setType(Constants.BUSINESSSERVICENAMES.get(generalOA.getIdentificationType())); + } + authoa.setIdentificationNumber(idnumber); @@ -1075,16 +1069,13 @@ public class EditOAAction extends BasicAction { if (userdb.isIsMandateUser() != null && userdb.isIsMandateUser()) { String bpk = userdb.getBpk(); - if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN) || bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_ZVR)) { + if (bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_FN) || bpk.startsWith(Constants.IDENIFICATIONTYPE_BASEID_ZVR) || bpk.startsWith(Constants.IDENIFICATIONTYPE_STORK)) { onlyBusinessService = true; generalOA.setBusinessService(true); - } else if (bpk.startsWith(Constants.IDENIFICATIONTYPE_STORK)) { - onlyStorkService = true; - generalOA.setStorkService(true); } deaktivededBusinessService = true; - deactivatedStorkService = true; + String[] split = bpk.split("\\+"); generalOA.setIdentificationType(split[1].substring(1)); @@ -1211,20 +1202,6 @@ public class EditOAAction extends BasicAction { return onlyBusinessService; } - /** - * @param onlyStorkService the onlyStorkService to set - */ - public void setOnlyStorkService(boolean onlyStorkService) { - this.onlyStorkService = onlyStorkService; - } - - /** - * @return the onlyStorkService - */ - public boolean isOnlyStorkService() { - return onlyStorkService; - } - /** * @param onlyBusinessService the onlyBusinessService to set */ @@ -1254,21 +1231,6 @@ public class EditOAAction extends BasicAction { return deaktivededBusinessService; } - /** - * @return the deactivatedStorkService - */ - public boolean isDeactivatedStorkService() { - return deactivatedStorkService; - } - - /** - * @param deactivatedStorkService the deactivatedStorkService to set - */ - - public void setDeactivatedStorkService(boolean deactivatedStorkService) { - - this.deactivatedStorkService = deactivatedStorkService; - } /** * @param deaktivededBusinessService the deaktivededBusinessService to set diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java index 92bdc2052..7b68f04d8 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/oa/OAGeneralConfigValidation.java @@ -174,23 +174,8 @@ public class OAGeneralConfigValidation { boolean businessservice = form.isBusinessService(); - boolean storkservice = form.isStorkService(); - if (storkservice) { - check = form.getStorkSPTargetCountry(); - if ((check==null)||(check.length() < 1)) { - log.warn("Stork target country is not known"); - errors.add(LanguageHelper.getErrorString("validation.general.stork.sptarget", request)); - } - - if (check.length() > 10) { - log.warn("Incorrect size of Stork target country, too many characters"); - errors.add(LanguageHelper.getErrorString("validation.general.stork.sptargetsize", request)); - } - - - - } else if (businessservice) { + if (businessservice) { //check identification type check = form.getIdentificationType(); diff --git a/id/ConfigWebTool/src/main/webapp/js/common.js b/id/ConfigWebTool/src/main/webapp/js/common.js index d31a65d87..18c755f4b 100644 --- a/id/ConfigWebTool/src/main/webapp/js/common.js +++ b/id/ConfigWebTool/src/main/webapp/js/common.js @@ -22,32 +22,15 @@ *******************************************************************************/ function oaBusinessService() { if ($('#OAisbusinessservice').attr('checked') == 'checked') { - $('#OAisstorkservice').attr('checked',false); - $('#oa_config_storkservice').css('display', "none"); $('#oa_config_businessservice').css('display', "block"); $('#oa_config_publicservice').css('display', "none"); } else { - $('#oa_config_storkservice').css('display', "none"); $('#oa_config_businessservice').css('display', "none"); $('#oa_config_publicservice').css('display', "block"); } } -function oaStorkService() { - if ($('#OAisstorkservice').attr('checked') == 'checked') { - $('#OAisbusinessservice').attr('checked',false); - $('#oa_config_storkservice').css('display', "block"); - $('#oa_config_businessservice').css('display', "none"); - $('#oa_config_publicservice').css('display', "none"); - - } else { - $('#oa_config_storkservice').css('display', "none"); - $('#oa_config_businessservice').css('display', "none"); - $('#oa_config_publicservice').css('display', "block"); - - } -} function oaSSOService() { if ($('#OAuseSSO').attr('checked') == 'checked') { @@ -214,7 +197,6 @@ function userOnLoad() { return true; } function oaOnLoad() { - oaStorkService(); oaBusinessService(); oaSSOService(); oaLegacyService(); diff --git a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp index 94f4a9d21..20a5ad1ea 100644 --- a/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp +++ b/id/ConfigWebTool/src/main/webapp/jsp/editOAGeneral.jsp @@ -70,17 +70,6 @@ > - - - - @@ -532,18 +521,7 @@ cssClass="checkbox" id="OAuseVidp" />

-
-<%--

<%=LanguageHelper.getGUIString("webpages.oaconfig.general.stork.header", request) %>

--%> - - -
- -

diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java index 866c5a923..7039a1fe0 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java @@ -46,6 +46,7 @@ package at.gv.egovernment.moa.id.auth.builder; +import at.gv.egovernment.moa.id.auth.data.IdentityLink; import at.gv.egovernment.moa.id.auth.exception.BuildException; import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.Base64Utils; @@ -137,28 +138,37 @@ public class BPKBuilder { /** * Builds the storkeid from the given parameters. * - * @param identificationValue Base64 encoded "Stammzahl" + * @param identityLink identity link * @param destinationCountry destination country code (2 chars) * @return storkid in a BASE64 encoding * @throws BuildException if an error occurs on building the wbPK */ - public String buildStorkbPK(String identificationValue, String destinationCountry) + public String buildStorkeIdentifier(IdentityLink identityLink, String destinationCountry) throws BuildException { - return buildStorkbPK(identificationValue, "AT", destinationCountry); + return buildStorkbPK(identityLink, "AT", destinationCountry); } /** * Builds the storkeid from the given parameters. * - * @param identificationValue Base64 encoded "Stammzahl" + * @param identityLink identity link * @param sourceCountry source country code (2 chars) * @param destinationCountry destination country code (2 chars) * @return storkid in a BASE64 encoding * @throws BuildException if an error occurs on building the wbPK */ - public String buildStorkbPK(String identificationValue, String sourceCountry, String destinationCountry) + public String buildStorkbPK(IdentityLink identityLink, String sourceCountry, String destinationCountry) throws BuildException { + String identificationValue = null; + + // check if we have been called by public sector application + if (identityLink.getIdentificationType().startsWith(Constants.URN_PREFIX_BASEID)) { + identificationValue = calculateStorkeIdentifierBase(identityLink, sourceCountry, destinationCountry); + } else { // if not, sector identification value is already calculated by BKU + Logger.info("STORK eIdentifier already provided by BKU"); + identificationValue = identityLink.getIdentificationValue(); + } if ((identificationValue == null || identificationValue.length() == 0 || @@ -173,20 +183,21 @@ public class BPKBuilder { Logger.info("Building STORK identification from: " + sourceCountry+"/"+destinationCountry+"/" + "[identValue]"); String eIdentifier = sourceCountry+"/"+destinationCountry+"/"+identificationValue; - /* Commented - it is already done by BKU, we need only to add Stork values - String basisbegriff = identificationValue + "+" + Constants.URN_PREFIX_STORK + "+" + sourceCountry + "+" + destinationCountry; + return eIdentifier; + } + + private String calculateStorkeIdentifierBase(IdentityLink identityLink, String sourceCountry, String destinationCountry) throws BuildException { + String basisbegriff = identityLink.getIdentificationValue() + "+" + Constants.URN_PREFIX_STORK + "+" + sourceCountry + "+" + destinationCountry; Logger.info("Building STORK identification from: [identValue]+" + Constants.URN_PREFIX_STORK + "+" + sourceCountry + "+" + destinationCountry); try { MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] hash = md.digest(basisbegriff.getBytes("ISO-8859-1")); String hashBase64 = Base64Utils.encode(hash); - Logger.info("STORK identification defined as: " + hashBase64); + Logger.debug("STORK identification defined as: " + hashBase64); return hashBase64; } catch (Exception ex) { throw new BuildException("builder.00", new Object[]{"storkid", ex.toString()}, ex); } - */ - return eIdentifier; } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java index b7afe4f8a..ff5e62d96 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/parser/StartAuthentificationParameterParser.java @@ -174,7 +174,7 @@ public class StartAuthentificationParameterParser implements MOAIDAuthConstants{ moasession.setBkuURL(bkuURL); - if ((!oaParam.getBusinessService())&&(!oaParam.getStorkService())) { + if ((!oaParam.getBusinessService())) { if (isEmpty(target)) throw new WrongParametersException("StartAuthentication", PARAM_TARGET, "auth.05"); @@ -192,7 +192,7 @@ public class StartAuthentificationParameterParser implements MOAIDAuthConstants{ moasession.setTarget(target); moasession.setBusinessService(oaParam.getBusinessService()); - moasession.setStorkService(oaParam.getStorkService()); + //moasession.setStorkService(oaParam.getStorkService()); Logger.debug("Business: " + moasession.getBusinessService() + " stork: " + moasession.getStorkService()); moasession.setTargetFriendlyName(targetFriendlyName); moasession.setDomainIdentifier(oaParam.getIdentityLinkDomainIdentifier()); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OAParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OAParameter.java index 2d0a0e367..31b88263b 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OAParameter.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/OAParameter.java @@ -56,12 +56,7 @@ public class OAParameter { else this.businessService = false; - if (this.oaType.equals("storkService")) - this.storkService = true; - else - this.storkService = false; - - this.publicURLPrefix = oa.getPublicURLPrefix(); + this.publicURLPrefix = oa.getPublicURLPrefix(); this.friendlyName = oa.getFriendlyName(); @@ -87,12 +82,6 @@ public class OAParameter { */ private boolean businessService; - /** - * specifies whether the online application is a stork application or not (true - * if value of {@link #oaType} is "storkService" - */ - private boolean storkService; - /** * public URL prefix of the online application @@ -152,6 +141,4 @@ public class OAParameter { return oAuth20Config; } - public boolean getStorkService() { return storkService; } - } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java index 5e9d9404c..370182e71 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/EHvdAttributeProviderPlugin.java @@ -193,7 +193,7 @@ public class EHvdAttributeProviderPlugin implements AttributeProvider { // add stork id for verification ArrayList value = new ArrayList(); - value.add(new BPKBuilder().buildStorkbPK(moasession.getIdentityLink().getIdentificationValue(), spCountryCode)); + value.add(new BPKBuilder().buildStorkeIdentifier(moasession.getIdentityLink(), spCountryCode)); result.add(new PersonalAttribute("eIdentifier", false, value, "Available")); return result; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java index 873ec1e26..21d6f2718 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java @@ -71,7 +71,7 @@ public class MOAAttributeProvider { private String geteIdentifier() { Logger.debug("Using base urn for identification value: " + identityLink.getIdentificationType() + " and target country: " + moastorkRequest.getStorkAuthnRequest().getSpCountry()); try { - return new BPKBuilder().buildStorkbPK(identityLink.getIdentificationValue(), moastorkRequest.getStorkAuthnRequest().getSpCountry()); + return new BPKBuilder().buildStorkeIdentifier(identityLink, moastorkRequest.getStorkAuthnRequest().getSpCountry()); } catch (BuildException be) { Logger.error("Stork eid could not be constructed; " + be.getMessage()); return null; // TODO error -- cgit v1.2.3