aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-eIDAS/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2015-12-20 22:07:54 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2015-12-20 22:07:54 +0100
commit8438e00eb12f34b2b5da0b8c07f39eaa49e96e37 (patch)
tree21b341a05153f6eb2203786c65abcee5c412a1c6 /id/server/modules/moa-id-module-eIDAS/src/main/java
parentbd13b36516fc5a57409348fba2d266c8fa8d8f99 (diff)
downloadmoa-id-spss-8438e00eb12f34b2b5da0b8c07f39eaa49e96e37.tar.gz
moa-id-spss-8438e00eb12f34b2b5da0b8c07f39eaa49e96e37.tar.bz2
moa-id-spss-8438e00eb12f34b2b5da0b8c07f39eaa49e96e37.zip
load service-provider configuration and moa-session object
in eIDAS create-AuthnRequest task
Diffstat (limited to 'id/server/modules/moa-id-module-eIDAS/src/main/java')
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java69
1 files changed, 44 insertions, 25 deletions
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java
index 0d9816f65..6483656ec 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/GenerateAuthnRequestTask.java
@@ -32,12 +32,19 @@ import eu.eidas.auth.commons.PersonalAttribute;
import eu.eidas.auth.commons.PersonalAttributeList;
import eu.eidas.auth.engine.EIDASSAMLEngine;
import eu.eidas.engine.exceptions.EIDASSAMLEngineException;
-
+import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants;
+import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
+import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask;
import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException;
import at.gv.egovernment.moa.id.auth.modules.eidas.exceptions.EIDASEngineException;
import at.gv.egovernment.moa.id.auth.modules.eidas.utils.SAMLEngineUtils;
+import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
+import at.gv.egovernment.moa.id.config.auth.IOAAuthParameters;
+import at.gv.egovernment.moa.id.moduls.IRequest;
+import at.gv.egovernment.moa.id.moduls.RequestStorage;
import at.gv.egovernment.moa.id.process.api.ExecutionContext;
+import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage;
import at.gv.egovernment.moa.logging.Logger;
/**
@@ -54,45 +61,57 @@ public class GenerateAuthnRequestTask extends AbstractAuthServletTask {
HttpServletRequest request, HttpServletResponse response)
throws TaskExecutionException {
+ try{
+ String moasessionid = (String) executionContext.get(MOAIDAuthConstants.PARAM_SESSIONID);
+ String pendingRequestID = (String) executionContext.get("pendingRequestID");
+
+ //load pending request
+ IRequest pendingReq = RequestStorage.getPendingRequest(pendingRequestID);
+ if (pendingReq == null) {
+ Logger.info("No PendingRequest with Id: " + pendingRequestID + " Maybe, a transaction timeout occure.");
+ throw new MOAIDException("auth.28", new Object[]{pendingRequestID});
+
+ }
+
+ //load MOASession object and OA-configuration
+ AuthenticationSession moasession = AuthenticationSessionStoreage.getSession(moasessionid);
+ IOAAuthParameters oaConfig = pendingReq.getOnlineApplicationConfiguration();
+
+
+ //build eIDAS AuthnRequest
+ EIDASAuthnRequest authnRequest = new EIDASAuthnRequest();
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ //create template requested attribute
+ //TODO: load required attributes from OA configuration
+ PersonalAttribute attr = new PersonalAttribute();
+ pAttList.add(attr);
+
- IPersonalAttributeList pAttList = new PersonalAttributeList();
-
- //create template requested attribute
- //TODO: load required attributes from OA configuration
- PersonalAttribute attr = new PersonalAttribute();
-
- pAttList.add(attr);
-
-
-
-
- //build eIDAS AuthnRequest
- EIDASAuthnRequest authnRequest = new EIDASAuthnRequest();
-
-
- try{
+
EIDASSAMLEngine engine = SAMLEngineUtils.createSAMLEngine();
engine.initRequestedAttributes(pAttList);
authnRequest = engine.generateEIDASAuthnRequest(authnRequest);
+ //encode AuthnRequest
+ byte[] token = authnRequest.getTokenSaml();
+ String SAMLRequest = EIDASUtil.encodeSAMLToken(token);
+
+
+ //send
+
+
}catch (EIDASSAMLEngineException e){
Logger.error("eIDAS AuthnRequest generation FAILED.", e);
throw new TaskExecutionException("eIDAS AuthnRequest generation FAILED.",
new EIDASEngineException("Could not generate token for Saml Request", e));
- } catch (EIDASEngineException e) {
+ } catch (EIDASEngineException | MOAIDException | MOADatabaseException e) {
throw new TaskExecutionException("eIDAS AuthnRequest generation FAILED.", e);
}
- //encode AuthnRequest
- byte[] token = authnRequest.getTokenSaml();
- String SAMLRequest = EIDASUtil.encodeSAMLToken(token);
-
-
- //send
-
}
}