summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.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/services/ProtocolAuthenticationService.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/services/ProtocolAuthenticationService.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java68
1 files changed, 32 insertions, 36 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
index a5030851..817c7aa2 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
@@ -24,14 +24,27 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.List;
+
import javax.naming.ConfigurationException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.ArrayUtils;
+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 org.springframework.context.ApplicationContext;
+import org.springframework.lang.NonNull;
+import org.springframework.lang.Nullable;
+import org.springframework.stereotype.Service;
+
import at.gv.egiz.components.eventlog.api.EventConstants;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
import at.gv.egiz.eaaf.core.api.IStatusMessenger;
-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.gui.IGuiBuilderConfiguration;
import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfigurationFactory;
import at.gv.egiz.eaaf.core.api.gui.IGuiFormBuilder;
@@ -40,7 +53,7 @@ import at.gv.egiz.eaaf.core.api.idp.IAction;
import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.IAuthenticationDataBuilder;
import at.gv.egiz.eaaf.core.api.idp.IModulInfo;
-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.auth.services.IProtocolAuthenticationService;
@@ -59,16 +72,6 @@ import at.gv.egiz.eaaf.core.exceptions.ProtocolNotActiveException;
import at.gv.egiz.eaaf.core.impl.gui.AbstractGuiFormBuilderConfiguration;
import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl;
import at.gv.egiz.eaaf.core.impl.utils.HttpUtils;
-import org.apache.commons.lang3.ArrayUtils;
-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 org.springframework.context.ApplicationContext;
-import org.springframework.lang.NonNull;
-import org.springframework.lang.Nullable;
-import org.springframework.stereotype.Service;
@Service
public class ProtocolAuthenticationService implements IProtocolAuthenticationService {
@@ -99,13 +102,13 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
@Autowired
private IRevisionLogger revisionsLogger;
-
private IGuiFormBuilder guiBuilder;
/*
* (non-Javadoc)
*
- * @see at.gv.egiz.eaaf.core.impl.idp.auth.services.IProtocolAuthenticationService#
+ * @see
+ * at.gv.egiz.eaaf.core.impl.idp.auth.services.IProtocolAuthenticationService#
* performAuthentication(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse, at.gv.egiz.eaaf.core.api.IRequest)
*/
@@ -121,16 +124,17 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
.setPendingRequestId(pendingReqIdGenerationStrategy.generateExternalPendingRequestId());
// load Parameters from OnlineApplicationConfiguration
- final IspConfiguration oaParam = pendingReq.getServiceProviderConfiguration();
+ final ISpConfiguration oaParam = pendingReq.getServiceProviderConfiguration();
if (oaParam == null) {
throw new EaafAuthenticationException(
IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOSPCONFIG,
- new Object[] {pendingReq.getSpEntityId()});
+ new Object[] { pendingReq.getSpEntityId() });
}
if (authmanager.doAuthentication(req, resp, pendingReq)) {
- // pending request is already authenticated --> protocol-specific postProcessing can start
+ // pending request is already authenticated --> protocol-specific postProcessing
+ // can start
// directly
finalizeAuthentication(req, resp, pendingReq);
@@ -155,7 +159,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
/*
* (non-Javadoc)
*
- * @see at.gv.egiz.eaaf.core.impl.idp.auth.services.IProtocolAuthenticationService#
+ * @see
+ * at.gv.egiz.eaaf.core.impl.idp.auth.services.IProtocolAuthenticationService#
* finalizeAuthentication(javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse, at.gv.egiz.eaaf.core.api.IRequest)
*/
@@ -210,11 +215,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
// remove pending-request
requestStorage.removePendingRequest(pendingReq.getPendingRequestId());
revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED,
- pendingReq.getUniqueTransactionIdentifier());
+ pendingReq.getUniqueTransactionIdentifier());
}
-
@Override
public void buildProtocolSpecificErrorResponse(final Throwable throwable,
final HttpServletRequest req, final HttpServletResponse resp, final IRequest protocolRequest)
@@ -285,7 +289,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
}
-
public void setGuiBuilder(final IGuiFormBuilder guiBuilder) {
this.guiBuilder = guiBuilder;
}
@@ -293,11 +296,11 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
/**
* Finalize the requested protocol operation.
*
- * @param httpReq HttpServletRequest
- * @param httpResp HttpServletResponse
+ * @param httpReq HttpServletRequest
+ * @param httpResp HttpServletResponse
* @param protocolRequest Authentication request which is actually in process
- * @param moaSession MOASession object, which is used to generate the protocol specific
- * authentication information
+ * @param moaSession MOASession object, which is used to generate the
+ * protocol specific authentication information
* @throws Exception In case of an error
*/
protected void internalFinalizeAuthenticationProcess(final HttpServletRequest req,
@@ -352,10 +355,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
/**
* Executes the requested protocol action.
*
- * @param httpReq HttpServletRequest
- * @param httpResp HttpServletResponse
+ * @param httpReq HttpServletRequest
+ * @param httpResp HttpServletResponse
* @param protocolRequest Authentication request which is actually in process
- * @param authData Service-provider specific authentication data
+ * @param authData Service-provider specific authentication data
*
* @return Return Single LogOut information or null if protocol supports no SSO
*
@@ -430,7 +433,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
final IGuiBuilderConfiguration config =
guiConfigFactory.getDefaultErrorGui(HttpUtils.extractAuthUrlFromRequest(httpReq));
-
String[] errorCodeParams = null;
if (params == null) {
errorCodeParams = new String[] {};
@@ -446,8 +448,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
}
}
-
-
// add errorcode and errormessage
if (config instanceof ModifyableGuiBuilderConfiguration) {
((ModifyableGuiBuilderConfiguration) config).putCustomParameter(
@@ -471,15 +471,12 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
"Can not ADD error message, because 'GUIBuilderConfiguration' is not modifieable ");
}
-
-
guiBuilder.build(httpReq, httpResp, config, "Error-Message");
} catch (final GuiBuildException e) {
log.warn("Can not build error-message GUI.", e);
throw new EaafException("9199", null, e);
-
}
}
@@ -496,7 +493,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
throws IOException, EaafException {
if (e instanceof ProtocolNotActiveException) {
resp.getWriter().write(e.getMessage());
- resp.setContentType(EAAFConstants.CONTENTTYPE_HTML_UTF8);
+ resp.setContentType(EaafConstants.CONTENTTYPE_HTML_UTF8);
resp.sendError(HttpServletResponse.SC_FORBIDDEN,
StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(e.getMessage())));
@@ -537,5 +534,4 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
}
-
}