diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2020-04-07 18:01:43 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2020-04-07 18:01:43 +0200 |
commit | cb5058036a9882a4398f501bb2e7d7a74b4b00b4 (patch) | |
tree | 68551c03f9ea7caa3135e24a4db0715c937c717c /eaaf_modules | |
parent | 4c91ab37d4b3d2daa7c50edcf2002ea4f6b7fbe9 (diff) | |
download | EAAF-Components-cb5058036a9882a4398f501bb2e7d7a74b4b00b4.tar.gz EAAF-Components-cb5058036a9882a4398f501bb2e7d7a74b4b00b4.tar.bz2 EAAF-Components-cb5058036a9882a4398f501bb2e7d7a74b4b00b4.zip |
set VDA sessionId into SL2.0 VDA request if it is available
Diffstat (limited to 'eaaf_modules')
2 files changed, 31 insertions, 1 deletions
diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java index 6a5e1ef0..6c11fa63 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/tasks/AbstractCreateQualEidRequestTask.java @@ -105,6 +105,18 @@ public abstract class AbstractCreateQualEidRequestTask extends AbstractAuthServl parameters.add(new BasicNameValuePair(SL20Constants.PARAM_SL20_REQ_AUTH_METHOD_PARAM, authMethod.getAuthMethod())); } + + //set VDA sessionId if it was available on context + String vdaSessionId = getVdaSessionIdFromContext(executionContext); + if (vdaSessionId != null) { + log.trace("Request VDA with sessionId: {}", vdaSessionId); + parameters.add(new BasicNameValuePair( + SL20Constants.PARAM_SL20_REQ_AUTH_VDA_SESSIONID, + vdaSessionId)); + + } + + httpReq.setEntity(new UrlEncodedFormEntity(parameters)); @@ -231,6 +243,22 @@ public abstract class AbstractCreateQualEidRequestTask extends AbstractAuthServl return null; } + private String getVdaSessionIdFromContext(ExecutionContext executionContext) { + Serializable vdaSessionId = executionContext.get( + SL20Constants.SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERROR_VDASESSIONID); + if (vdaSessionId instanceof String + && StringUtils.isNotEmpty((CharSequence) vdaSessionId)) { + executionContext.remove( + SL20Constants.SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERROR_VDASESSIONID); + + log.trace("Find vdaSessionId parameter: {} on context", vdaSessionId); + return (String) vdaSessionId; + + } + + return null; + } + private String extractVdaUrlForSpecificOa(final ISpConfiguration oaConfig, final ExecutionContext executionContext) { // load SP specific config for development and testing purposes diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20Constants.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20Constants.java index 8c520931..6c3c7545 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20Constants.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20Constants.java @@ -19,6 +19,7 @@ public class SL20Constants { public static final String PARAM_SL20_REQ_COMMAND_PARAM_OLD = "sl2command"; public static final String PARAM_SL20_REQ_AUTH_METHOD_PARAM = "authtype"; + public static final String PARAM_SL20_REQ_AUTH_VDA_SESSIONID = "handySignaturSession"; public enum VdaAuthMethod { ANY("any"), MOBILEPHONE("handy"), CARD("card"), SMARTPHONE("smartphone"); @@ -176,7 +177,8 @@ public class SL20Constants { // error command public static final String SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERRORCODE = "errorCode"; public static final String SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERRORMESSAGE = "errorMessage"; - public static final String SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERROR_VDASESSIONID = "handySignaturSession"; + public static final String SL20_COMMAND_PARAM_GENERAL_RESPONSE_ERROR_VDASESSIONID + = PARAM_SL20_REQ_AUTH_VDA_SESSIONID; // qualified eID command @Deprecated |