diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2017-07-13 07:06:14 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2017-07-13 07:06:14 +0200 |
commit | 3e2575cfe85ac8f3076f0470a82191d9f1dae636 (patch) | |
tree | f557f2e5415094905071c5d3a436bfba527f0a76 /id/server/modules/moa-id-module-bkaMobilaAuthSAML2Test/src/main/java/at | |
parent | 250a89d7eaeb1c8a905fa7bb2032992946fec40f (diff) | |
download | moa-id-spss-3e2575cfe85ac8f3076f0470a82191d9f1dae636.tar.gz moa-id-spss-3e2575cfe85ac8f3076f0470a82191d9f1dae636.tar.bz2 moa-id-spss-3e2575cfe85ac8f3076f0470a82191d9f1dae636.zip |
update DummyAuthentication module to support more than one SP
Diffstat (limited to 'id/server/modules/moa-id-module-bkaMobilaAuthSAML2Test/src/main/java/at')
-rw-r--r-- | id/server/modules/moa-id-module-bkaMobilaAuthSAML2Test/src/main/java/at/gv/egovernment/moa/id/auth/modules/bkamobileauthtests/BKAMobileAuthModule.java | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/id/server/modules/moa-id-module-bkaMobilaAuthSAML2Test/src/main/java/at/gv/egovernment/moa/id/auth/modules/bkamobileauthtests/BKAMobileAuthModule.java b/id/server/modules/moa-id-module-bkaMobilaAuthSAML2Test/src/main/java/at/gv/egovernment/moa/id/auth/modules/bkamobileauthtests/BKAMobileAuthModule.java index 72087180a..44554e21d 100644 --- a/id/server/modules/moa-id-module-bkaMobilaAuthSAML2Test/src/main/java/at/gv/egovernment/moa/id/auth/modules/bkamobileauthtests/BKAMobileAuthModule.java +++ b/id/server/modules/moa-id-module-bkaMobilaAuthSAML2Test/src/main/java/at/gv/egovernment/moa/id/auth/modules/bkamobileauthtests/BKAMobileAuthModule.java @@ -22,12 +22,19 @@ */ package at.gv.egovernment.moa.id.auth.modules.bkamobileauthtests; +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.PostConstruct; + import org.springframework.beans.factory.annotation.Autowired; import at.gv.egovernment.moa.id.auth.modules.AuthModule; import at.gv.egovernment.moa.id.commons.MOAIDAuthConstants; import at.gv.egovernment.moa.id.commons.api.AuthConfiguration; +import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; import at.gv.egovernment.moa.id.process.api.ExecutionContext; +import at.gv.egovernment.moa.logging.Logger; import at.gv.egovernment.moa.util.MiscUtil; /** @@ -40,6 +47,8 @@ public class BKAMobileAuthModule implements AuthModule { @Autowired protected AuthConfiguration authConfig; + private List<String> uniqueIDsDummyAuthEnabled = new ArrayList<String>(); + /* (non-Javadoc) * @see at.gv.egovernment.moa.id.auth.modules.AuthModule#getPriority() */ @@ -56,15 +65,29 @@ public class BKAMobileAuthModule implements AuthModule { this.priority = priority; } + + @PostConstruct + public void initialDummyAuthWhiteList() { + String sensitiveSpIdentifier = authConfig.getBasicMOAIDConfiguration("modules.bkamobileAuth.entityID"); + if (MiscUtil.isNotEmpty(sensitiveSpIdentifier)) { + uniqueIDsDummyAuthEnabled.addAll(KeyValueUtils.getListOfCSVValues(sensitiveSpIdentifier)); + + if (!uniqueIDsDummyAuthEnabled.isEmpty()) { + Logger.info("Dummy authentication is enabled for ...."); + for (String el : uniqueIDsDummyAuthEnabled) + Logger.info(" EntityID: " + el); + } + } + } + /* (non-Javadoc) * @see at.gv.egovernment.moa.id.auth.modules.AuthModule#selectProcess(at.gv.egovernment.moa.id.process.api.ExecutionContext) */ @Override - public String selectProcess(ExecutionContext context) { + public String selectProcess(ExecutionContext context) { String spEntityID = (String) context.get(MOAIDAuthConstants.PROCESSCONTEXT_UNIQUE_OA_IDENTFIER); - if (MiscUtil.isNotEmpty(spEntityID)) { - String sensitiveSpIdentifier = authConfig.getBasicMOAIDConfiguration("modules.bkamobileAuth.entityID"); - if (spEntityID.equalsIgnoreCase(sensitiveSpIdentifier)) + if (MiscUtil.isNotEmpty(spEntityID)) { + if (uniqueIDsDummyAuthEnabled.contains(spEntityID)) return "BKAMobileAuthentication"; } |