Skip to content

Commit 62a3412

Browse files
committed
Ensured that requests to the api with the given token are successfull
1 parent 5578930 commit 62a3412

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

server/src/auth/jwt-auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Request, Response, NextFunction } from "express";
33

44
const authenticateJWT = (req: Request, res: Response, next: NextFunction) => {
55
const authHeader = req.headers.authorization;
6-
6+
console.log(req);
77
if (authHeader) {
88
const token = authHeader.split(" ")[1];
99
jwt.verify(token, process.env.JWT_SECRET!, (err, user) => {

server/src/routes/cascade-router.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import express, { Request, Response, Router } from "express";
22
import { DatabaseController } from "../database-controller";
33
import { GetQuery, RadData, Testing } from "../types";
4+
import authenticateJWT from "../auth/jwt-auth";
5+
46

57
const router = express.Router();
68

web/src/auth/CASCallback.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ const CASCallback: React.FC = () => {
1111
if (ticket) {
1212
// Call backend to validate ticket
1313
fetch(`${BACKEND_URL}/api/adminRequest/auth/cas-validate?ticket=${ticket}&service=${encodeURIComponent(window.location.origin + '/cas-callback')}`)
14-
.then((response) => response.json())
14+
.then((response) => {
15+
console.log(response);
16+
return response.json()})
1517
.then((data) => {
1618
if (data.token) {
1719
// Store JWT in localStorage or cookies

0 commit comments

Comments
 (0)