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
committerlalber <lukas.alber@iaik.tugraz.at>2021-03-16 14:45:30 +0100
commit5bd780462933b439d2e323c18a5404da60e764a5 (patch)
tree146f633a9818ce581fc4e1f4ff39b3b256ac3fcd /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java
parent5abcd67602145c06715f71a7e420a1b10271e1a6 (diff)
downloadEAAF-Components-5bd780462933b439d2e323c18a5404da60e764a5.tar.gz
EAAF-Components-5bd780462933b439d2e323c18a5404da60e764a5.tar.bz2
EAAF-Components-5bd780462933b439d2e323c18a5404da60e764a5.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.java28
1 files changed, 14 insertions, 14 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 bb6f45d0..6cbd72a5 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
@@ -77,7 +77,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashSet;
-import static at.gv.egiz.eaaf.core.api.IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC;
@Service
public class ProtocolAuthenticationService implements IProtocolAuthenticationService {
@@ -203,8 +202,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!");
@@ -236,8 +235,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);
@@ -282,8 +281,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 {
@@ -447,7 +446,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 {
@@ -472,7 +472,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,
@@ -508,8 +508,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(),
@@ -523,7 +523,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());
@@ -544,8 +544,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer
String redirectUrl = null;
redirectUrl = ServletUtils.getBaseUrl(req);
redirectUrl +=
- "/" + ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?" + EaafConstants.PARAM_HTTP_ERROR_CODE + "=" +
- errorKey;
+ "/" + ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?" + EaafConstants.PARAM_HTTP_ERROR_CODE + "="
+ + errorKey;
return redirectUrl;
}