Skip to content

Commit

Permalink
laget whitelistpaths for feature
Browse files Browse the repository at this point in the history
  • Loading branch information
sindredl committed Feb 23, 2024
1 parent f310519 commit 307ce0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions server/src/paths/whitelistPaths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const whitelistPaths = ['feature'];
12 changes: 8 additions & 4 deletions server/src/proxy/api-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import tokenx from '../login/tokenx';
import azure from '../login/azure';
import { Express } from 'express';
import { BaseClient } from 'openid-client';
import proxy from 'express-http-proxy';
import { Request } from 'express-serve-static-core';
import { createProxyMiddleware } from 'http-proxy-middleware';
import proxy from 'express-http-proxy';
import { BaseClient } from 'openid-client';
import { ParsedQs } from 'qs';
import azure from '../login/azure';
import tokenx from '../login/tokenx';
import { whitelistPaths } from '../paths/whitelistPaths';

const tokenxSetup = (app: Express, tokenxClient: BaseClient): void => {
console.log('api-proxy setup for tokenx');
Expand Down Expand Up @@ -58,6 +59,9 @@ function setupPath(app: Express) {

app.use('/tiltaksgjennomforing/api', (req, res, next) => {
console.log('apiProxy /tiltaksgjennomforing/api');
if (whitelistPaths.includes(req.path)) {
next();
}
if (!req.headers['authorization']) {
res.status(401).send();
} else {
Expand Down

0 comments on commit 307ce0e

Please sign in to comment.