Skip to content

Commit

Permalink
restore unused files
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Aug 23, 2024
1 parent e818c3f commit 7d6c067
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 67 deletions.
18 changes: 5 additions & 13 deletions backend/src/main/java/ch/puzzle/okr/ForwardFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.GenericFilterBean;

import java.io.IOException;
Expand All @@ -15,30 +16,21 @@
public class ForwardFilter extends GenericFilterBean {

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

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

// logger.debug(String.format("This is the URI '%s'", path));
// if (path.startsWith("/?state")) {
// logger.debug("change path to /dashboard");
//
// request.getRequestDispatcher("/dashboard");
// }
logger.info("This is the URI: " + path);
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(), "/"));
request.getRequestDispatcher("/").forward(request, servletResponse);
servletRequest.getRequestDispatcher("/").forward(servletRequest, servletResponse);
return;
}

logger.debug(String.format("====> pass through the filter '%s'", request.getRequestURI()));
filterChain.doFilter(request, servletResponse);
filterChain.doFilter(servletRequest, servletResponse);
}
}

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { ApplicationTopBarComponent } from './application-top-bar/application-to
import { TeamComponent } from './team/team.component';
import { OverviewComponent } from './overview/overview.component';
import { ObjectiveComponent } from './objective/objective.component';
import { CommonModule, LocationStrategy, NgOptimizedImage } from '@angular/common';
import { CommonModule, NgOptimizedImage } from '@angular/common';
import { KeyresultComponent } from './keyresult/keyresult.component';
import { KeyresultDetailComponent } from './keyresult-detail/keyresult-detail.component';
import { ObjectiveDetailComponent } from './objective-detail/objective-detail.component';
Expand Down
8 changes: 1 addition & 7 deletions frontend/src/app/shared/customRouter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { NavigationExtras, Router } from '@angular/router';

@Injectable()
export class CustomRouter extends Router {
Expand All @@ -8,12 +8,6 @@ export class CustomRouter extends Router {
}

override navigate(commands: any[], extras?: NavigationExtras | undefined): Promise<boolean> {
// const noMergeParams = ['iss', 'state', 'session_state'];
// const newQueryParam = new URLSearchParams(window.location.search);
// if (noMergeParams.every((e) => newQueryParam.has(e))) {
// return super.navigate(commands, extras);
// }

const customExtras = { ...extras, queryParamsHandling: 'merge' } as NavigationExtras;
return super.navigate(commands, customExtras);
}
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/shared/guards/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export const authGuard: CanActivateFn = (route, state) => {
const oauthService = inject(OAuthService);
const router = inject(Router);

console.log('test123');
return oauthService.loadDiscoveryDocumentAndTryLogin().then(async () => {
// if the login failed initialize code flow
let validToken = oauthService.hasValidIdToken();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const environment = {
customQueryParams: { response_modes_supported: ['query'] },
// redirectUri: 'http://localhost:8080/auth/keycloakopenid/callback',
// redirectUri: `${window.location.protocol}//${window.location.hostname}:${window.location.port}/auth/keycloakopenid/callback${window.location.search}`,
redirectUri: window.location.origin + '/dashboard',
redirectUri: window.location.origin,
scope: 'profile openid',
clientId: 'pitc_okr_prod',
responseType: 'code',
Expand Down
1 change: 0 additions & 1 deletion frontend/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const environment = {
decreaseExpirationBySec: 30,
clearHashAfterLogin: true,
issuer: '',
customQueryParams: { response_mode: 'query' },
strictDiscoveryDocumentValidation: false,
redirectUri: 'http://localhost:4200',
scope: 'openid profile',
Expand Down

0 comments on commit 7d6c067

Please sign in to comment.