diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2021-11-22 17:25:00 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2021-11-22 17:25:00 +0100 |
commit | fc0385dbeee71f1ce18783ef1c7a4d06288fdb0d (patch) | |
tree | 48c1c7ce79bbf02a5c369cb3c2d135359c17bbb8 /id/server/modules/moa-id-module-E-ID_connector | |
parent | e3d6ec57d438058cc9d36905c327cd5c9f0233ce (diff) | |
parent | 9128d32d0bbbdc4d7183d3e189ffd3f59905aad5 (diff) | |
download | moa-id-spss-fc0385dbeee71f1ce18783ef1c7a4d06288fdb0d.tar.gz moa-id-spss-fc0385dbeee71f1ce18783ef1c7a4d06288fdb0d.tar.bz2 moa-id-spss-fc0385dbeee71f1ce18783ef1c7a4d06288fdb0d.zip |
Merge branch 'master' of gitlab.iaik.tugraz.at:egiz/moa-idspss
Diffstat (limited to 'id/server/modules/moa-id-module-E-ID_connector')
4 files changed, 46 insertions, 5 deletions
diff --git a/id/server/modules/moa-id-module-E-ID_connector/pom.xml b/id/server/modules/moa-id-module-E-ID_connector/pom.xml index fe47e5704..9764a8ee6 100644 --- a/id/server/modules/moa-id-module-E-ID_connector/pom.xml +++ b/id/server/modules/moa-id-module-E-ID_connector/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>MOA.id.server.modules</groupId> <artifactId>moa-id-modules</artifactId> - <version>4.1.4</version> + <version>4.1.5</version> </parent> <artifactId>moa-id-module-EID_connector</artifactId> <name>moa-id-module-E-ID_connector</name> diff --git a/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/controller/EidAppRegIdentifierGenerationController.java b/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/controller/EidAppRegIdentifierGenerationController.java index 091feb7fc..1478a6f45 100644 --- a/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/controller/EidAppRegIdentifierGenerationController.java +++ b/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/controller/EidAppRegIdentifierGenerationController.java @@ -87,7 +87,7 @@ public class EidAppRegIdentifierGenerationController extends AbstractController } - String appRegId = Utils.getEidSystemApplicationId(oaParam, authUrl); + String appRegId = Utils.getEidSystemApplicationId(oaParam, authUrl, authConfig); config.putCustomParameterWithOutEscaption(null, "appregId", appRegId); guiBuilder.build(req, resp, config, "AppReg Id generation GUI"); diff --git a/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/tasks/CreateAuthnRequestTask.java b/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/tasks/CreateAuthnRequestTask.java index 177103051..124377845 100644 --- a/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/tasks/CreateAuthnRequestTask.java +++ b/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/tasks/CreateAuthnRequestTask.java @@ -113,7 +113,7 @@ public class CreateAuthnRequestTask extends AbstractAuthServletTask { authnReqConfig.setSignCred(credential.getIDPAssertionSigningCredential()); authnReqConfig.setSPEntityID(pendingReq.getAuthURL() + EIDProxyAuthConstants.ENDPOINT_METADATA); authnReqConfig.setScopeRequesterId( - Utils.getEidSystemApplicationId(pendingReq.getServiceProviderConfiguration(), pendingReq.getAuthURL())); + Utils.getEidSystemApplicationId(pendingReq.getServiceProviderConfiguration(), pendingReq.getAuthURL(), authConfig)); //build and transmit AuthnRequest authnReqBuilder.buildAuthnRequest(pendingReq, authnReqConfig , response); diff --git a/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/utils/Utils.java b/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/utils/Utils.java index 0de1a9df2..f58ca4743 100644 --- a/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/utils/Utils.java +++ b/id/server/modules/moa-id-module-E-ID_connector/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidproxyauth/utils/Utils.java @@ -9,14 +9,24 @@ import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration; import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; import at.gv.egovernment.moa.id.auth.modules.eidproxyauth.EIDProxyAuthConstants; import at.gv.egovernment.moa.id.commons.api.AuthConfiguration; +import at.gv.egovernment.moa.id.commons.api.IOAAuthParameters; import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; import at.gv.egovernment.moa.logging.Logger; +import at.gv.egovernment.moa.util.MiscUtil; public class Utils { + public static final String CONFIG_PROP_EID_APPREG_ID_LAYOUT_V2 = + "modules.eidproxyauth.appreg.id.layout.v2"; + public static final String PARAM_APPREG_SP_ID = "?sp="; - public static String getEidSystemApplicationId(ISPConfiguration spConfiguration, String authUrl) { + public static final String PARAM_PROTOCOL_SAML1 = "/saml1"; + public static final String PARAM_PROTOCOL_SAML2 = "/saml2"; + public static final String PARAM_PROTOCOL_OIDC = "/oidc"; + + public static String getEidSystemApplicationId(ISPConfiguration spConfiguration, String authUrl, + IConfiguration authConfig) { StringBuilder builder = new StringBuilder(); if (authUrl.endsWith("/")) { builder.append(authUrl.substring(0, authUrl.length() - 1)); @@ -25,13 +35,43 @@ public class Utils { builder.append(authUrl); } + + if (authConfig.getBasicConfigurationBoolean(Utils.CONFIG_PROP_EID_APPREG_ID_LAYOUT_V2, true)) { + builder.append(selectProtocolFromSpConfig(spConfiguration)); + + } builder.append(PARAM_APPREG_SP_ID); builder.append(spConfiguration.getUniqueIdentifier()); return builder.toString(); } - public static String getEIDSystemEntityId(ISPConfiguration spConfiguration, IConfiguration authConfig) { + private static String selectProtocolFromSpConfig(ISPConfiguration spConfiguration) { + if (spConfiguration instanceof IOAAuthParameters) { + IOAAuthParameters spConf = (IOAAuthParameters) spConfiguration; + if (MiscUtil.isNotEmpty( + spConf.getConfigurationValue(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_URL))) { + Logger.debug("SP: " + spConf.getUniqueIdentifier() + " marked as: " + PARAM_PROTOCOL_SAML2); + return PARAM_PROTOCOL_SAML2; + + } else if (MiscUtil.isNotEmpty( + spConf.getConfigurationValue(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_OPENID_REDIRECTURL))) { + Logger.debug("SP: " + spConf.getUniqueIdentifier() + " marked as: " + PARAM_PROTOCOL_OIDC); + return PARAM_PROTOCOL_OIDC; + + } + + } else { + Logger.warn("Can NOT estimate type of SPConfiguration. Use SAML1 as default"); + + } + + Logger.debug("SP: " + spConfiguration.getUniqueIdentifier() + " marked as: " + PARAM_PROTOCOL_SAML1); + return PARAM_PROTOCOL_SAML1; + + } + + public static String getEIDSystemEntityId(ISPConfiguration spConfiguration, IConfiguration authConfig) { //load from service-provider configuration String msNodeEntityID = spConfiguration.getConfigurationValue(MOAIDConfigurationConstants.SERVICE_EXTERNAL_EID_SYSTEM_SERVICE_URL); @@ -59,4 +99,5 @@ public class Utils { return msNodeEntityID; } + } |