aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
authorThomas <>2023-03-02 11:09:43 +0100
committerThomas <>2023-03-02 11:09:43 +0100
commit72785de93272ba74a5b587403cd5097727674115 (patch)
tree5c3c4a2a31d0f0c5b26f4fe08ce22c7f3891e4c4 /modules/authmodule-eIDAS-v2/src/main
parent779eb51796aecd05606b7abc69851b02214d21cd (diff)
downloadNational_eIDAS_Gateway-72785de93272ba74a5b587403cd5097727674115.tar.gz
National_eIDAS_Gateway-72785de93272ba74a5b587403cd5097727674115.tar.bz2
National_eIDAS_Gateway-72785de93272ba74a5b587403cd5097727674115.zip
feat(connector): make nameIdFormat configurable for earch citizen country
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/main')
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java16
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java4
2 files changed, 16 insertions, 4 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
index fa26e48f..80348f3d 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
@@ -78,6 +78,7 @@ public abstract class AbstractEidProcessor implements INationalEidProcessor {
validateSelectionWithState(pendingReq, countryCode);
// build country-specific authentication request
+ buildNameIdPolicy(authnRequestBuilder, countryCode);
buildLevelOfAssurance(pendingReq.getServiceProviderConfiguration(), authnRequestBuilder);
buildProviderNameAndRequesterIdAttribute(pendingReq, authnRequestBuilder);
buildRequestedAttributes(authnRequestBuilder);
@@ -320,6 +321,21 @@ public abstract class AbstractEidProcessor implements INationalEidProcessor {
}
+ private void buildNameIdPolicy(Builder authnRequestBuilder, String countryCode) {
+ String ccSpecificPolicy = basicConfig.getBasicConfiguration(
+ Constants.CONFIG_PROP_EIDAS_NODE_NAMEIDFORMAT + "." + countryCode.toLowerCase());
+
+ if (StringUtils.isNotEmpty(ccSpecificPolicy)) {
+ log.debug("Using specific nameIdFormat:{} to request: {}", ccSpecificPolicy, countryCode);
+ authnRequestBuilder.nameIdFormat(ccSpecificPolicy);
+
+ } else {
+ log.trace("Using default nameIdFormat to request: {}", countryCode);
+ authnRequestBuilder.nameIdFormat(
+ basicConfig.getBasicConfiguration(Constants.CONFIG_PROP_EIDAS_NODE_NAMEIDFORMAT));
+
+ }
+ }
private void buildRequestedAttributes(Builder authnRequestBuilder) {
// build and add requested attribute set
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java
index cf6ecb8d..82489e25 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java
@@ -181,10 +181,6 @@ public class GenerateAuthnRequestTask extends AbstractAuthServletTask {
final LightRequest.Builder builder = LightRequest.builder();
builder.id(UUID.randomUUID().toString());
- // set nameIDFormat
- builder.nameIdFormat(
- authConfig.getBasicConfiguration(Constants.CONFIG_PROP_EIDAS_NODE_NAMEIDFORMAT));
-
builder.citizenCountryCode(citizenCountryCode);
builder.issuer(issuer);
// Add country-specific information into eIDAS request