Skip to content

Commit

Permalink
feat(maintenance mode): maintenance page display
Browse files Browse the repository at this point in the history
* do not block theme usage in error pages

Covers [DEV-479](https://bonitasoft.atlassian.net/browse/DEV-479)
  • Loading branch information
abirembaut committed Oct 6, 2023
1 parent b0a4654 commit 9470dd9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class AuthenticationFilter extends ExcludingPatternFilter {

protected static final String USER_NOT_FOUND_JSP = "/usernotfound.jsp";

public static final String ERROR_PAGE_REQUEST_PATH_REGEX = "/portal/resource/app/appDirectoryBonita/error-\\d+/content/.*";
public static final String ERROR_PAGE_REQUEST_PATH_REGEX = "/portal/resource/app/appDirectoryBonita/error-\\d+/(content|theme)/.*";

protected boolean redirectWhenUnauthorized;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,20 @@ public void should_be_able_to_display_error_pages_in_maintenance() throws Except
verify(httpResponse, never()).sendError(eq(HttpServletResponse.SC_SERVICE_UNAVAILABLE), anyString());
}

@Test
public void should_be_able_to_display_error_pages_theme_in_maintenance() throws Exception {
when(httpRequest.getServletPath()).thenReturn("/portal/resource/app");
when(httpRequest.getPathInfo()).thenReturn("/appDirectoryBonita/error-503/theme/theme.css");
doReturn(true).when(authenticationFilter).isPlaformInMaintenance(request);
authenticationFilter.addRule(createPassingRule());

authenticationFilter.doAuthenticationFiltering(request, httpResponse, chain);

verify(authenticationManager, never()).getLoginPageURL(eq(request), anyString());
verify(chain).doFilter(httpRequest, httpResponse);
verify(httpResponse, never()).sendError(eq(HttpServletResponse.SC_SERVICE_UNAVAILABLE), anyString());
}

@Test
public void should_let_technical_user_pass_when_platform_is_in_maintenance() throws Exception {
when(httpRequest.getServletPath()).thenReturn("/apps");
Expand Down

0 comments on commit 9470dd9

Please sign in to comment.