Skip to content

Commit

Permalink
provide angular for all routes
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Aug 30, 2024
1 parent 0e6425e commit 75878b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
9 changes: 0 additions & 9 deletions backend/src/main/java/ch/puzzle/okr/ForwardFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@
public class ForwardFilter extends GenericFilterBean {

private static final Logger logger = LoggerFactory.getLogger(ForwardFilter.class);
private final String[] allowedRoutes = { "/keyresult", "/objective", "/callback", "/dashboard" };

@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
String path = request.getRequestURI();

if (Arrays.stream(this.allowedRoutes).anyMatch(path::startsWith)) {
logger.info(String.format("Keycloak state parameter detected ====> make a forward from '%s' to '%s'",
request.getRequestURI(), "/"));
servletRequest.getRequestDispatcher("/").forward(servletRequest, servletResponse);
return;
}
logger.debug(String.format("====> pass through the filter '%s'", request.getRequestURI()));
filterChain.doFilter(servletRequest, servletResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import ch.puzzle.okr.service.clientconfig.ClientConfigService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/config")
@Controller
public class ClientConfigController {

private final ClientConfigService configService;
Expand All @@ -18,8 +18,13 @@ public ClientConfigController(ClientConfigService configService) {
this.configService = configService;
}

@GetMapping
@GetMapping("/config")
public ResponseEntity<ClientConfigDto> getConfig() {
return ResponseEntity.status(HttpStatus.OK).body(configService.getConfigBasedOnActiveEnv());
}

@RequestMapping(value = "/{path:[^\\.]*}")
public String redirect() {
return "forward:/index.html";
}
}

0 comments on commit 75878b7

Please sign in to comment.