Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud-Lyard committed Jun 13, 2024
2 parents ab959ab + 88b78de commit 2e03cda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/Dockerfile.production
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ COPY postcss.config.mjs ./postcss.config.mjs
ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_API_URL ${NEXT_PUBLIC_API_URL}

ARG JWT_PUBLIC_KEY
ENV JWT_PUBLIC_KEY ${JWT_PUBLIC_KEY}

RUN npm run build

CMD npm start
3 changes: 3 additions & 0 deletions client/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const privateUrls = ['/admin', '/profile'];
async function importKey() {
const alg = 'RS256';
const spki = process.env.JWT_PUBLIC_KEY!;
console.log('spki', spki);
const publicKey = await jose.importSPKI(spki, alg);
console.log('publicKey', publicKey);
return publicKey;
}

Expand All @@ -33,6 +35,7 @@ async function authMiddleware(request: NextRequest) {
if (token) {
try {
const key = await importKey();
console.log(key);
const { payload } = await jose.jwtVerify(token, key);
console.log('payload', payload);
if (payload.sub) return NextResponse.next();
Expand Down

0 comments on commit 2e03cda

Please sign in to comment.