diff options
author | Thomas <thomas.lenz@egiz.gv.at> | 2019-05-04 09:37:22 +0200 |
---|---|---|
committer | Thomas <thomas.lenz@egiz.gv.at> | 2019-05-04 09:37:22 +0200 |
commit | f9a438a837221dae0320bcddefa6a86b6be7f75d (patch) | |
tree | 9eaba1b9db34e0cd7fbcf8914b6549bf0f78c2cc /eaaf_modules/eaaf_module_auth_sl20 | |
parent | 6065ba01b3f49e6f79179cc85a38e4229e47d306 (diff) | |
parent | 2e921528557a23b96fb6b52b2b53a28048a826fd (diff) | |
download | EAAF-Components-f9a438a837221dae0320bcddefa6a86b6be7f75d.tar.gz EAAF-Components-f9a438a837221dae0320bcddefa6a86b6be7f75d.tar.bz2 EAAF-Components-f9a438a837221dae0320bcddefa6a86b6be7f75d.zip |
Merge branch 'master' of https://gitlab.iaik.tugraz.at/egiz/eaaf_components
Diffstat (limited to 'eaaf_modules/eaaf_module_auth_sl20')
3 files changed, 11 insertions, 7 deletions
diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/AbstractSL20AuthenticationModulImpl.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/AbstractSL20AuthenticationModulImpl.java index b23df12e..f6488626 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/AbstractSL20AuthenticationModulImpl.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/AbstractSL20AuthenticationModulImpl.java @@ -28,7 +28,7 @@ public abstract class AbstractSL20AuthenticationModulImpl implements AuthModule private int priority = 3; public static final List<String> VDA_TYPE_IDS = Arrays.asList("1", "2", "3", "4"); - + @Autowired(required=true) protected IConfiguration authConfig; @Autowired(required=true) private AbstractAuthenticationManager authManager; @@ -59,11 +59,11 @@ public abstract class AbstractSL20AuthenticationModulImpl implements AuthModule */ @Override public String selectProcess(ExecutionContext context) { - ISPConfiguration spConfig = (ISPConfiguration) context.get(EAAFConstants.PROCESSCONTEXT_SP_CONFIG); + final ISPConfiguration spConfig = (ISPConfiguration) context.get(EAAFConstants.PROCESSCONTEXT_SP_CONFIG); + + final String sl20ClientTypeHeader = (String) context.get(SL20Constants.HTTP_HEADER_SL20_CLIENT_TYPE.toLowerCase()); + final String sl20VDATypeHeader = (String) context.get(SL20Constants.HTTP_HEADER_SL20_VDA_TYPE.toLowerCase()); - String sl20ClientTypeHeader = (String) context.get(SL20Constants.HTTP_HEADER_SL20_CLIENT_TYPE.toLowerCase()); - String sl20VDATypeHeader = (String) context.get(SL20Constants.HTTP_HEADER_SL20_VDA_TYPE.toLowerCase()); - if (spConfig != null && StringUtils.isNotEmpty(spConfig.getConfigurationValue(getConfigPropertyNameEnableModule())) && Boolean.valueOf(spConfig.getConfigurationValue(getConfigPropertyNameEnableModule()))) { 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 b5b82174..416c16b6 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 @@ -21,6 +21,8 @@ public class SL20Constants { public static final String HTTP_HEADER_SL20_VDA_TYPE = "X-MOA-VDA"; public static final String HTTP_HEADER_VALUE_NATIVE = "nativeApp"; + public static final String HTTP_HEADER_SL20_RESP = "X-SL20Operation"; + //******************************************************************************************* //JSON signing and encryption headers diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java index 78edf640..e1cca5ef 100644 --- a/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java +++ b/eaaf_modules/eaaf_module_auth_sl20/src/main/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/SL20HttpBindingUtils.java @@ -20,10 +20,12 @@ public class SL20HttpBindingUtils { public static void writeIntoResponse(HttpServletRequest request, HttpServletResponse response, JsonNode sl20Forward, String redirectURL) throws IOException, URISyntaxException { //forward SL2.0 command + response.addIntHeader(SL20Constants.HTTP_HEADER_SL20_RESP, SL20Constants.CURRENT_SL20_VERSION); + if (request.getHeader(SL20Constants.HTTP_HEADER_SL20_CLIENT_TYPE) != null && request.getHeader(SL20Constants.HTTP_HEADER_SL20_CLIENT_TYPE).equals(SL20Constants.HTTP_HEADER_VALUE_NATIVE)) { log.debug("Client request containts 'native client' header ... "); - StringWriter writer = new StringWriter(); + final StringWriter writer = new StringWriter(); writer.write(sl20Forward.toString()); final byte[] content = writer.toString().getBytes("UTF-8"); response.setStatus(HttpServletResponse.SC_OK); @@ -33,7 +35,7 @@ public class SL20HttpBindingUtils { } else { log.debug("Client request containts is no native client ... "); - URIBuilder clientRedirectURI = new URIBuilder(redirectURL); + final URIBuilder clientRedirectURI = new URIBuilder(redirectURL); clientRedirectURI.addParameter( SL20Constants.PARAM_SL20_REQ_COMMAND_PARAM, Base64Url.encode(sl20Forward.toString().getBytes())); |