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 --- .../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 +- 6 files changed, 28 insertions(+), 35 deletions(-) (limited to 'id/server/idserverlib/src/main/java/at') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index 1b120c7c1..d7083ec81 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -277,16 +277,11 @@ public class AuthenticationServer implements MOAIDAuthConstants { } else { Log.info("Non-SSO Login requested"); - if (oaParam.getStorkService()) { - // build stork request - infoboxReadRequest = new InfoboxReadRequestBuilder().buildStorkReadRequest( - oaParam.getIdentityLinkDomainIdentifier()); - } else { //build ReadInfobox request infoboxReadRequest = new InfoboxReadRequestBuilder().build( oaParam.getBusinessService(), oaParam .getIdentityLinkDomainIdentifier()); - } + } @@ -414,7 +409,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { // if OA is type is business service the manifest validation result has // to be ignored - boolean ignoreManifestValidationResult = (oaParam.getBusinessService() || oaParam.getStorkService()) ? true + boolean ignoreManifestValidationResult = (oaParam.getBusinessService()) ? true : false; // validates the 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