summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
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/AbstractAuthenticationManager.java
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/AbstractAuthenticationManager.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java76
1 files changed, 35 insertions, 41 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
index 241b43c9..d2365e4a 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
@@ -24,14 +24,22 @@ import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
+
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
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.IspConfiguration;
+import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration;
import at.gv.egiz.eaaf.core.api.idp.auth.IAuthenticationManager;
import at.gv.egiz.eaaf.core.api.idp.auth.ISsoManager;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
@@ -46,11 +54,6 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.modules.ModuleRegistration;
import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl;
import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.text.StringEscapeUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
public abstract class AbstractAuthenticationManager implements IAuthenticationManager {
private static final Logger log = LoggerFactory.getLogger(AbstractAuthenticationManager.class);
@@ -73,14 +76,14 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
protected IRevisionLogger revisionsLogger;
@Autowired(required = false)
protected ISsoManager ssoManager;
- @Autowired ModuleRegistration moduleRegistration;
+ @Autowired
+ ModuleRegistration moduleRegistration;
/*
* (non-Javadoc)
*
- * @see
- * at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#addParameterNameToWhiteList(java.lang
- * .String)
+ * @see at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#
+ * addParameterNameToWhiteList(java.lang .String)
*/
@Override
public final void addParameterNameToWhiteList(final String httpReqParam) {
@@ -93,9 +96,8 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
/*
* (non-Javadoc)
*
- * @see
- * at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#addHeaderNameToWhiteList(java.lang.
- * String)
+ * @see at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#
+ * addHeaderNameToWhiteList(java.lang. String)
*/
@Override
public final void addHeaderNameToWhiteList(final String httpReqParam) {
@@ -108,9 +110,8 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
/*
* (non-Javadoc)
*
- * @see
- * at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#addHeaderNameToWhiteList(java.lang.
- * String)
+ * @see at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#
+ * addHeaderNameToWhiteList(java.lang. String)
*/
@Override
public final boolean doAuthentication(final HttpServletRequest httpReq,
@@ -124,7 +125,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
}
// load OA configuration from pending request
- final IspConfiguration oaParam = pendingReq.getServiceProviderConfiguration();
+ final ISpConfiguration oaParam = pendingReq.getServiceProviderConfiguration();
// set logging context and log unique OA identifier to revision log
TransactionIdUtils.setServiceProviderId(oaParam.getUniqueIdentifier());
@@ -137,7 +138,6 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
throw new NoPassivAuthenticationException();
}
-
// check Single Sign-On functionality if SSOManager is available
boolean isValidSsoSession = false;
if (ssoManager != null) {
@@ -149,16 +149,15 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
isValidSsoSession = ssoManager.checkAndValidateSsoSession(pendingReq, httpReq, httpResp)
&& pendingReq.needSingleSignOnFunctionality();
-
}
// check if session is already authenticated
- // boolean isSessionAuthenticated = tryPerformAuthentication((RequestImpl) pendingReq,
+ // boolean isSessionAuthenticated = tryPerformAuthentication((RequestImpl)
+ // pendingReq,
// isValidSSOSession);
// boolean isSessionAuthenticated = isValidSSOSession &&
// StringUtils.isNotEmpty(pendingReq.getSSOSessionIdentifier());
-
// force new authentication authentication process
if (pendingReq.forceAuth()) {
startAuthenticationProcess(httpReq, (RequestImpl) pendingReq);
@@ -169,7 +168,6 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
sendSingleSignOnConsentsEvaluation((RequestImpl) pendingReq);
return false;
-
} else if (pendingReq.isPassiv()) {
if (isValidSsoSession
&& StringUtils.isNotEmpty(pendingReq.getInternalSsoSessionIdentifier())) {
@@ -207,7 +205,6 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
log.debug("Close session. Remove pending request ... ");
requestStoreage.removePendingRequest(pendingReq.getPendingRequestId());
-
if (ssoManager != null) {
try {
log.trace("'SSOManager' active. Search for active SSO sessions ... ");
@@ -229,11 +226,11 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
/**
* Populate process execution context and start process engine.
*
- * @param httpReq http request
+ * @param httpReq http request
* @param pendingReq current pending request
* @throws ServletException In case of a servlet error
- * @throws IOException In case of an IO error
- * @throws EaafException In case of EAAF processing error
+ * @throws IOException In case of an IO error
+ * @throws EaafException In case of EAAF processing error
*/
private void startAuthenticationProcess(final HttpServletRequest httpReq,
final RequestImpl pendingReq) throws EaafException {
@@ -245,15 +242,15 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
final ExecutionContext executionContext = new ExecutionContextImpl();
// set oaIdentifeir
- executionContext.put(EAAFConstants.PROCESS_ENGINE_SERVICE_PROVIDER_ENTITYID,
+ executionContext.put(EaafConstants.PROCESS_ENGINE_SERVICE_PROVIDER_ENTITYID,
pendingReq.getServiceProviderConfiguration().getUniqueIdentifier());
// add X509 SSL client certificate if exist
if (httpReq.getAttribute("javax.servlet.request.X509Certificate") != null) {
log.debug("Find SSL-client-certificate on request --> Add it to context");
- executionContext.put(EAAFConstants.PROCESS_ENGINE_SSL_CLIENT_CERTIFICATE,
+ executionContext.put(EaafConstants.PROCESS_ENGINE_SSL_CLIENT_CERTIFICATE,
(X509Certificate[]) httpReq.getAttribute("javax.servlet.request.X509Certificate"));
- pendingReq.setRawDataToTransaction(EAAFConstants.PROCESS_ENGINE_SSL_CLIENT_CERTIFICATE,
+ pendingReq.setRawDataToTransaction(EaafConstants.PROCESS_ENGINE_SSL_CLIENT_CERTIFICATE,
httpReq.getAttribute("javax.servlet.request.X509Certificate"));
}
@@ -287,8 +284,6 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
}
}
-
-
// populate more IDP specific information to execution context
populateExecutionContext(executionContext, pendingReq, httpReq);
@@ -301,8 +296,8 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
* Add additional parameters into context of process-engine.
*
* @param executionContext Process-engine context
- * @param pendingReq Current pending request
- * @param httpReq http request
+ * @param pendingReq Current pending request
+ * @param httpReq http request
*
* @throws EaafException In case of an error
*/
@@ -314,8 +309,8 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
*
* @param pendingReq current pending request
* @throws ServletException In case of a servlet error
- * @throws IOException In case of an IO error
- * @throws EaafException In case of a EAAF processing error
+ * @throws IOException In case of an IO error
+ * @throws EaafException In case of a EAAF processing error
*/
private void sendSingleSignOnConsentsEvaluation(final RequestImpl pendingReq) throws EaafException {
@@ -333,11 +328,10 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
}
-
/**
* Select a specific process and starting process engine.
*
- * @param pendingReq current pending request
+ * @param pendingReq current pending request
* @param executionContext current context for process-engine
* @throws EaafException In case of an process-engine error
*/
@@ -345,7 +339,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
final ExecutionContext executionContext) throws EaafException {
try {
// put pending-request ID on execurtionContext
- executionContext.put(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID,
+ executionContext.put(EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID,
pendingReq.getPendingRequestId());
// create process instance
@@ -354,7 +348,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
if (processDefinitionId == null) {
log.warn("No suitable process found for PendingReqId " + pendingReq.getPendingRequestId());
- throw new EaafException("process.02", new Object[] {pendingReq.getPendingRequestId()});
+ throw new EaafException("process.02", new Object[] { pendingReq.getPendingRequestId() });
}
@@ -383,7 +377,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
}
throw new EaafException("process.01",
- new Object[] {pendingReq.getProcessInstanceId(), pendingReq.getPendingRequestId()}, e);
+ new Object[] { pendingReq.getProcessInstanceId(), pendingReq.getPendingRequestId() }, e);
}
}