summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules
diff options
context:
space:
mode:
authorThomas <thomas.lenz@egiz.gv.at>2019-12-05 09:52:48 +0100
committerThomas <thomas.lenz@egiz.gv.at>2019-12-05 09:52:48 +0100
commit3fada6cef21c9b16467177d866df778203b51b4d (patch)
tree8fe8ed37b6ee9fe35a1e035ceba6c68808328415 /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules
parent95b21a826e5d81fdeabcf4673a9e87047edaec9d (diff)
downloadEAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.tar.gz
EAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.tar.bz2
EAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.zip
some code code-style modifications
active code-quality checks!
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java67
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java32
2 files changed, 51 insertions, 48 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
index c785e1cb..3d093a9f 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
@@ -27,11 +27,24 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.lang3.ArrayUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ResourceLoader;
+
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
-import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
+import at.gv.egiz.eaaf.core.api.data.EaafConstants;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
@@ -41,20 +54,10 @@ import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
import at.gv.egiz.eaaf.core.impl.idp.controller.ProtocolFinalizationController;
import at.gv.egiz.eaaf.core.impl.idp.process.springweb.AbstractTask;
import at.gv.egiz.eaaf.core.impl.utils.DataUrlBuilder;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.FileUploadException;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.commons.lang3.ArrayUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ResourceLoader;
/**
- * Task based counterpart to {@link AuthServlet}, providing the same utility methods (error
- * handling, parameter parsing etc.).
+ * Task based counterpart to {@link AuthServlet}, providing the same utility
+ * methods (error handling, parameter parsing etc.).
* </p>
* The code has been taken from {@link AuthServlet}.
*/
@@ -81,7 +84,6 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
public abstract void execute(ExecutionContext executionContext, HttpServletRequest request,
HttpServletResponse response) throws TaskExecutionException;
-
@Override
protected final IRequest internalExecute(final IRequest pendingReq,
final ExecutionContext executionContext, final HttpServletRequest request,
@@ -90,7 +92,7 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
this.pendingReq = pendingReq;
// add latest pendingRequestId on execution context
- executionContext.put(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID,
+ executionContext.put(EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID,
pendingReq.getPendingRequestId());
// execute task specific action
@@ -101,20 +103,22 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
}
/**
- * Redirect the authentication process to protocol specific finalization endpoint.
+ * Redirect the authentication process to protocol specific finalization
+ * endpoint.
*
* @param executionContext
*
- * @param pendingReq Actually processed protocol specific authentication request
- * @param httpResp http response object
- * @throws IOException In case of a general error
+ * @param pendingReq Actually processed protocol specific authentication
+ * request
+ * @param httpResp http response object
+ * @throws IOException In case of a general error
* @throws EaafException In case of an application error
*/
protected void performRedirectToProtocolFinialization(final ExecutionContext executionContext,
final IRequest pendingReq, final HttpServletRequest httpReq,
final HttpServletResponse httpResp) throws EaafException, IOException {
final Object frontChannelRedirectFlagObj =
- executionContext.get(EAAFConstants.PROCESS_ENGINE_REQUIRES_NO_POSTAUTH_REDIRECT);
+ executionContext.get(EaafConstants.PROCESS_ENGINE_REQUIRES_NO_POSTAUTH_REDIRECT);
if (frontChannelRedirectFlagObj != null && frontChannelRedirectFlagObj instanceof Boolean
&& (Boolean) frontChannelRedirectFlagObj) {
log.info("AuthProcess finished. Forward to Protocol finalization.");
@@ -128,15 +132,14 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
}
-
-
}
/**
* Redirect the authentication process to IDP itself.
*
- * @param pendingReq Actually processed protocol specific authentication request
- * @param httpResp http response
+ * @param pendingReq Actually processed protocol specific authentication
+ * request
+ * @param httpResp http response
* @param idpEndPoint Servlet EndPoint that should receive the redirect
*/
protected void performRedirectToItself(final IRequest pendingReq,
@@ -151,16 +154,15 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
}
-
/**
- * Parses the request input stream for parameters, assuming parameters are encoded UTF-8 (no
- * standard exists how browsers should encode them).
+ * Parses the request input stream for parameters, assuming parameters are
+ * encoded UTF-8 (no standard exists how browsers should encode them).
*
* @param req servlet request
*
* @return mapping parameter name -> value
*
- * @throws IOException if parsing request parameters fails.
+ * @throws IOException if parsing request parameters fails.
*
* @throws FileUploadException if parsing request parameters fails.
*/
@@ -215,7 +217,8 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
final Entry<String, String[]> entry = requestParamIt.next();
final String key = entry.getKey();
final String[] values = entry.getValue();
- // take the last value from the value array since the legacy code above also does it this
+ // take the last value from the value array since the legacy code above also
+ // does it this
// way
parameters.put(key, ArrayUtils.isEmpty(values) ? null : values[values.length - 1]);
}
@@ -228,7 +231,7 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
/**
* Reads bytes up to a delimiter, consuming the delimiter.
*
- * @param in input stream
+ * @param in input stream
* @param delimiter delimiter character
* @return String constructed from the read bytes
* @throws IOException In case of a general error
@@ -251,8 +254,8 @@ public abstract class AbstractAuthServletTask extends AbstractTask {
/**
* Adds a parameter to a URL.
*
- * @param url the URL
- * @param paramname parameter name
+ * @param url the URL
+ * @param paramname parameter name
* @param paramvalue parameter value
* @return the URL with parameter added
*/
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java
index 27aeab03..c4f1b505 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java
@@ -27,12 +27,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
+
import javax.annotation.PostConstruct;
-import at.gv.egiz.eaaf.core.api.IRequest;
-import at.gv.egiz.eaaf.core.api.idp.auth.modules.AuthModule;
-import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
-import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine;
-import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException;
+
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,13 +37,20 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.idp.auth.modules.AuthModule;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine;
+import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException;
+
/**
- * This class handles registering modules. The modules are detected either with the ServiceLoader
- * mechanism or via Spring. All detected modules are ranked according to their priority.
+ * This class handles registering modules. The modules are detected either with
+ * the ServiceLoader mechanism or via Spring. All detected modules are ranked
+ * according to their priority.
*/
public class ModuleRegistration {
- //private static ModuleRegistration instance = new ModuleRegistration();
+ // private static ModuleRegistration instance = new ModuleRegistration();
private final List<AuthModule> priorizedModules = new ArrayList<>();
@@ -58,10 +62,6 @@ public class ModuleRegistration {
private final Logger log = LoggerFactory.getLogger(getClass());
-// public static ModuleRegistration getInstance() {
-// return ctx.;
-// }
-
private ModuleRegistration() {
}
@@ -77,7 +77,7 @@ public class ModuleRegistration {
// order modules according to their priority
sortModules();
- //instance = this;
+ // instance = this;
}
/**
@@ -142,10 +142,10 @@ public class ModuleRegistration {
}
/**
- * Returns the process description id of the first process, in the highest ranked module, which is
- * able to work with the given execution context.
+ * Returns the process description id of the first process, in the highest
+ * ranked module, which is able to work with the given execution context.
*
- * @param context the {@link ExecutionContext}.
+ * @param context the {@link ExecutionContext}.
* @param pendingReq the current processed {@link IRequest}
* @return the process id or {@code null}
*/