summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
diff options
context:
space:
mode:
authorlalber <lukas.alber@iaik.tugraz.at>2021-03-16 14:45:30 +0100
committerThomas <>2021-03-30 20:22:44 +0200
commitfaa131a65b46a5c42a7b6b85e0ff3b414c93bea5 (patch)
treeb5b9387b580ed56369c5b826533b1cd4d3086dc4 /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
parentae656225445f45b26c2ebdf4ebe8bc820e1c3db0 (diff)
downloadEAAF-Components-faa131a65b46a5c42a7b6b85e0ff3b414c93bea5.tar.gz
EAAF-Components-faa131a65b46a5c42a7b6b85e0ff3b414c93bea5.tar.bz2
EAAF-Components-faa131a65b46a5c42a7b6b85e0ff3b414c93bea5.zip
add some Junit fixes and other spotbug based ones
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.java25
1 files changed, 12 insertions, 13 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 9627e01a..5d656e76 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
@@ -80,7 +80,6 @@ import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils;
import at.gv.egiz.eaaf.core.impl.utils.ServletUtils;
-import static at.gv.egiz.eaaf.core.api.IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC;
@Service
public class ProtocolAuthenticationService implements IProtocolAuthenticationService {
@@ -206,8 +205,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
log.warn("PendingRequest flag for 'authenticated':{} and 'needConsent':{}", pendingReq.isAuthenticated(),
pendingReq.isNeedUserConsent());
if (pendingReq.isNeedUserConsent()) {
- log.error("PendingRequest NEEDS user-consent. " +
- "Can NOT fininalize authentication --> Abort authentication process!");
+ log.error("PendingRequest NEEDS user-consent. "
+ + "Can NOT fininalize authentication --> Abort authentication process!");
} else {
log.error("PendingRequest is NOT authenticated --> Abort authentication process!");
@@ -239,8 +238,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
ErrorTicketService.HandleData errorData = errorTicketService.createHandleData(throwable, req);
- if (errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_REDIRECT) ||
- errorData.getActionType().equals(ErrorTicketService.ActionType.TICKET_REDIRECT)) {
+ if (errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_REDIRECT) || errorData.getActionType()
+ .equals(ErrorTicketService.ActionType.TICKET_REDIRECT)) {
displayException(req, resp, errorData);
@@ -285,8 +284,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
// write errror to console
logExceptionToTechnicalLog(errorData);
- if (errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_NOREDIRECT) ||
- errorData.getActionType().equals(ErrorTicketService.ActionType.TICKET_NOREDIRECT)) {
+ if (errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_NOREDIRECT) || errorData.getActionType()
+ .equals(ErrorTicketService.ActionType.TICKET_NOREDIRECT)) {
// return error to Web browser
displayException(req, resp, errorData);
} else {
@@ -450,7 +449,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
// this.writeHtmlErrorResponse(httpReq, httpResp, msg, errorCode, params, externalErrorCode, null, null);
// }
- public void writeHtmlErrorResponse(@NonNull final HttpServletRequest httpReq,
+
+ private void writeHtmlErrorResponse(@NonNull final HttpServletRequest httpReq,
@NonNull final HttpServletResponse httpResp, @NonNull final String msg, @NonNull final String errorCode,
@Nullable final Object[] params, String externalErrorCode, String url, String ticket) throws EaafException {
@@ -475,7 +475,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
// add errorcode and errormessage
if (config instanceof ModifyableGuiBuilderConfiguration) {
- ModifyableGuiBuilderConfiguration c = ((ModifyableGuiBuilderConfiguration) config);
+ ModifyableGuiBuilderConfiguration c = (ModifyableGuiBuilderConfiguration) config;
c.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERROMSG, msg);
c.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERRORCODE, errorCode);
c.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_EXTERNAL_ERRORCODE,
@@ -511,8 +511,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
resp.sendError(HttpServletResponse.SC_FORBIDDEN,
StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(e.getMessage())));
- } else if (e instanceof AuthnRequestValidatorException || e instanceof InvalidProtocolRequestException ||
- e instanceof ProcessExecutionException || e instanceof ConfigurationException) {
+ } else if (e instanceof AuthnRequestValidatorException || e instanceof InvalidProtocolRequestException
+ || e instanceof ProcessExecutionException || e instanceof ConfigurationException) {
// write error message
writeHtmlErrorResponse(req, resp, e.getMessage(), internalErrorCode, null,
statusMessager.mapInternalErrorToExternalError(internalErrorCode), errorData.getRedirectUrl(),
@@ -526,7 +526,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
} else {
// write generic message for general exceptions
- final String msg = statusMessager.getMessage(CODES_INTERNAL_ERROR_GENERIC, null);
+ final String msg = statusMessager.getMessage(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null);
writeHtmlErrorResponse(req, resp, msg, internalErrorCode, null,
statusMessager.mapInternalErrorToExternalError(internalErrorCode), errorData.getRedirectUrl(),
errorData.getSupportTicket());
@@ -548,7 +548,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
redirectUrl = ServletUtils.getBaseUrl(req);
redirectUrl += ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?"
+ EaafConstants.PARAM_HTTP_ERROR_CODE + "=" + errorKey;
-
return redirectUrl;
}