aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/AuthenticationManager.java34
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/ModuleRegistration.java16
2 files changed, 34 insertions, 16 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/AuthenticationManager.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/AuthenticationManager.java
index 0c481d94e..1a0c11aa1 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/AuthenticationManager.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/AuthenticationManager.java
@@ -76,6 +76,7 @@ import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.data.SLOInformationContainer;
import at.gv.egovernment.moa.id.data.SLOInformationImpl;
+import at.gv.egovernment.moa.id.moduls.moduleregistration.ModuleRegistration;
import at.gv.egovernment.moa.id.protocols.pvp2x.PVPTargetConfiguration;
import at.gv.egovernment.moa.id.protocols.pvp2x.binding.IEncoder;
import at.gv.egovernment.moa.id.protocols.pvp2x.binding.PostBinding;
@@ -94,9 +95,11 @@ import at.gv.egovernment.moa.id.util.Random;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
+import com.datentechnik.process_engine.ExecutionContextImpl;
import com.datentechnik.process_engine.ProcessEngine;
import com.datentechnik.process_engine.ProcessExecutionException;
import com.datentechnik.process_engine.ProcessInstance;
+import com.datentechnik.process_engine.api.ExecutionContext;
public class AuthenticationManager implements MOAIDAuthConstants {
@@ -544,13 +547,26 @@ public class AuthenticationManager implements MOAIDAuthConstants {
Logger.info("Start Authentication Module: " + moasession.getModul()
+ " Action: " + moasession.getAction());
-
+ // create execution context
+ ExecutionContext executionContext = new ExecutionContextImpl();
+ executionContext.put("ccc", moasession.getCcc());
+ executionContext.put("useMandate", moasession.getUseMandate());
+ executionContext.put("bkuURL", moasession.getBkuURL());
+ executionContext.put(PARAM_SESSIONID, moasession.getSessionID());
+
// create process instance
- // TODO[MOAID-49]: Automatically selection of process
- ProcessInstance pi = processEngine.createProcessInstance("DefaultAuthentication");
- // keep process instance id in moa session
- moasession.setProcessInstanceId(pi.getId());
-
+ String processDefinitionId = ModuleRegistration.getInstance().selectProcess(executionContext);
+
+ if (processDefinitionId == null) {
+ Logger.warn("No suitable process found for SessionID " + moasession.getSessionID() );
+ throw new MOAIDException("process.02",new Object[] {
+ moasession.getSessionID()});
+ }
+
+ ProcessInstance pi = processEngine.createProcessInstance(processDefinitionId, executionContext);
+ // keep process instance id in moa session
+ moasession.setProcessInstanceId(pi.getId());
+
// make sure moa session has been persisted before running the process
try {
AuthenticationSessionStoreage.storeSession(moasession);
@@ -560,12 +576,6 @@ public class AuthenticationManager implements MOAIDAuthConstants {
moasession.getSessionID()});
}
- // set execution context
- pi.getExecutionContext().put("ccc", moasession.getCcc());
- pi.getExecutionContext().put("useMandate", moasession.getUseMandate());
- pi.getExecutionContext().put("bkuURL", moasession.getBkuURL());
- pi.getExecutionContext().put(PARAM_SESSIONID, moasession.getSessionID());
-
// start process
processEngine.start(pi);
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/ModuleRegistration.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/ModuleRegistration.java
index 522e5c7eb..b90e0d94f 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/ModuleRegistration.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/moduleregistration/ModuleRegistration.java
@@ -1,5 +1,7 @@
package at.gv.egovernment.moa.id.moduls.moduleregistration;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
+import com.datentechnik.process_engine.ProcessDefinitionParserException;
import com.datentechnik.process_engine.ProcessEngine;
import com.datentechnik.process_engine.api.ExecutionContext;
@@ -94,11 +97,16 @@ public class ModuleRegistration {
for (String uri : module.getProcessDefinitions()) {
Resource resource = ctx.getResource(uri);
if (resource.exists()) {
- log.debug("Registering process definition resource url: '{}'.", resource);
- // TODO: register resource with the process engine
- // processEngine.registerResourceUri(resource);
+ log.debug("Registering process definition resource uri: '{}'.", resource);
+ try (InputStream processDefinitionInputStream = resource.getInputStream()) {
+ processEngine.registerProcessDefinition(processDefinitionInputStream);
+ } catch (IOException e) {
+ log.info("Resource uri: '{}' could NOT be read.", resource);
+ } catch (ProcessDefinitionParserException e) {
+ log.warn("Error while parsing process definition in '{}'", resource);
+ }
} else {
- log.info("Resource url: '{}' does NOT exist.", resource);
+ log.info("Resource uri: '{}' does NOT exist.", resource);
}
}
}