diff options
2 files changed, 17 insertions, 11 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java index 8bcb5305..08fb04c6 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java @@ -39,7 +39,8 @@ public class ErrorTicketService { public enum ActionType { TICKET_REDIRECT("ticket_redirect"), TICKET_NOREDIRECT("ticket_noredirect"), NOTICKET_REDIRECT( - "noticket_redirect"), NOTICKET_NOREDIRECT("noticket_noredirect"); + "noticket_redirect"), NOTICKET_NOREDIRECT("noticket_noredirect"), NOTICKET_AUTOREDIRECT( + "noticket_autoredirect"); private final String name; @@ -67,7 +68,7 @@ public class ErrorTicketService { if (StringUtils.isEmpty(ticketConfPath)) { - log.error("Error: Path to errorhandling action configuration not known"); + log.error("Error: Path to errorhandling-action mapping not known"); throw new EaafException("internal.configuration.00", new Object[]{CONFIG_PROP_ERRORHANDLING_ACTION_PATH}); } else { @@ -90,7 +91,8 @@ public class ErrorTicketService { } catch (Exception e) { log.error("Error: could not found file.", e); throw new EaafException("internal.configuration.01", - new Object[]{CONFIG_PROP_ERRORHANDLING_ACTION_PATH, "File cloud not be found."}); + new Object[]{CONFIG_PROP_ERRORHANDLING_ACTION_PATH, "File for errorhandling-action mapping cloud " + + "not be found."}); } } } @@ -148,6 +150,9 @@ public class ErrorTicketService { data.actionType = ActionType.NOTICKET_REDIRECT; data.generateRedirect(); + } else if (action.equals(ActionType.NOTICKET_AUTOREDIRECT.toString())) { + data.actionType = ActionType.NOTICKET_AUTOREDIRECT; + } else { // ActionType.NOTICKET_NOREDIRECT -> nothing to be done data.actionType = ActionType.NOTICKET_NOREDIRECT; 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 d078d085..09977f52 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 @@ -234,7 +234,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer try { ErrorTicketService.HandleData errorData = errorTicketService.createHandleData(throwable, req); - if (errorData.getActionType().equals(ErrorTicketService.ActionType.TICKET_REDIRECT)) { + if (errorData.getActionType().equals(ErrorTicketService.ActionType.TICKET_REDIRECT) + || errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_REDIRECT)) { // Put pending request ExceptionContainer exceptionContainer = new ExceptionContainer(protocolRequest, throwable); @@ -253,7 +254,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer displayException(req, resp, errorData); - } else if (errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_REDIRECT)) { + } else if (errorData.getActionType().equals(ErrorTicketService.ActionType.NOTICKET_AUTOREDIRECT)) { IModulInfo handlingModule = extractShibbolethHandling(protocolRequest, applicationContext); if (handlingModule.generateErrorMessage(throwable, req, resp, protocolRequest)) { @@ -278,7 +279,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer } - } catch (final Throwable e) { // + } catch (final Throwable e) { // if building error response results in error, we try with with handleErrorNoRedirect handleErrorNoRedirect(e, req, resp, true); @@ -287,18 +288,18 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer /** * Retrieves shibboleth module info. - * @param protocolRequest current request + * + * @param protocolRequest current request * @param applicationContext spring context * @return IModulInfo * @throws ClassNotFoundException If no shibboleth handling implementation found */ - public static IModulInfo extractShibbolethHandling(IRequest protocolRequest, - ApplicationContext applicationContext) throws ClassNotFoundException { + public static IModulInfo extractShibbolethHandling(IRequest protocolRequest, ApplicationContext applicationContext) + throws ClassNotFoundException { final Class<?> clazz = Class.forName(protocolRequest.requestedModule()); if (clazz == null || !IModulInfo.class.isAssignableFrom(clazz)) { - log.error( - "Requested protocol module Class is NULL or does not implement the IModulInfo interface."); + log.error("Requested protocol module Class is NULL or does not implement the IModulInfo interface."); throw new ClassCastException( "Requested protocol module Class is NULL or does not implement the IModulInfo interface."); |