File tree Expand file tree Collapse file tree 5 files changed +24
-7
lines changed
Expand file tree Collapse file tree 5 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ async function initializeSystem(): Promise<DatabaseController> {
4444initializeSystem ( ) . then ( ( dbController : DatabaseController ) => {
4545 app . use ( "/" , exampleRouter ) ;
4646 //app.use("/getTable", tableRouter)
47- app . use ( "/dataRequest" , cascadeRouter ( dbController ) ) ;
48- app . use ( "/adminRequest" , adminRouter ( dbController ) ) ;
47+ app . use ( "/api/ dataRequest" , cascadeRouter ( dbController ) ) ;
48+ app . use ( "/api/ adminRequest" , adminRouter ( dbController ) ) ;
4949
5050 app . listen ( PORT , ( ) => {
5151 console . log ( `Server is running on ${ PORT } ` ) ;
Original file line number Diff line number Diff line change @@ -55,22 +55,29 @@ export default function adminRouter(dbController: DatabaseController): Router {
5555 router . get ( "/auth/cas-validate" , async ( req : Request , res : Response ) => {
5656 const { ticket, service } = req . query ;
5757
58+ console . log ( "hit" ) ;
59+ console . log ( ticket ) ;
60+ console . log ( service ) ;
5861 if ( ! ticket || ! service ) {
5962 res . status ( 400 ) . json ( { error : "Missing ticket or service" } ) ;
6063 }
6164
6265 try {
6366 // Validate CAS ticket
6467 const casResponse = await axios . get (
65- `https://cas.usask.ca/serviceValidate` ,
68+ `https://cas.usask.ca/cas/ serviceValidate` ,
6669 {
6770 params : { ticket, service } ,
6871 } ,
6972 ) ;
7073
74+
75+
7176 const casData = casResponse . data ; // assumed user CAS info, need to test to see
7277 const nsid = casData . user ; // Potentally the nsid of the user. Again need to test
7378
79+ console . log ( casData ) ;
80+ console . log ( nsid ) ;
7481 if ( ! nsid ) {
7582 res . status ( 401 ) . json ( { error : "Invalid CAS Ticket" } ) ;
7683 }
Original file line number Diff line number Diff line change @@ -15,7 +15,15 @@ function App() {
1515 < Routes >
1616 { /* Unprotected routes */ }
1717 < Route path = "/cas-callback" element = { < CASCallback /> } />
18-
18+
19+ < Route
20+ path = "/"
21+ element = {
22+ < ProtectedRoute >
23+ < div > Hello</ div >
24+ </ ProtectedRoute >
25+ }
26+ > </ Route >
1927 { /* Protected Routes */ }
2028 < Route
2129 path = "/upload"
Original file line number Diff line number Diff line change 11import React , { useEffect } from 'react' ;
22
3- const BACKEND_URL = 'https://starr-lab-server.usask.ca/api ' ; // Replace with your backend URL
3+ const BACKEND_URL = 'https://starr-lab-server.usask.ca' ; // Replace with your backend URL
44
55const CASCallback : React . FC = ( ) => {
66 useEffect ( ( ) => {
77 // Extract CAS ticket from URL
88 const urlParams = new URLSearchParams ( window . location . search ) ;
99 const ticket = urlParams . get ( 'ticket' ) ;
1010
11+ console . log ( ticket ) ;
12+
1113 if ( ticket ) {
1214 // Call backend to validate ticket
13- fetch ( `${ BACKEND_URL } /admin-router /auth/cas-validate?ticket=${ ticket } &service=${ encodeURIComponent ( window . location . origin + '/cas-callback' ) } ` )
15+ fetch ( `${ BACKEND_URL } /api/adminRequest /auth/cas-validate?ticket=${ ticket } &service=${ encodeURIComponent ( window . location . origin + '/cas-callback' ) } ` )
1416 . then ( ( response ) => response . json ( ) )
1517 . then ( ( data ) => {
1618 if ( data . token ) {
Original file line number Diff line number Diff line change 11function redirectToCAS ( ) {
22 const CAS_SERVER = "https://cas.usask.ca/cas" ;
3- const FRONTEND_URL = "https://starr-lab-server.usask.ca:5173/ " ;
3+ const FRONTEND_URL = "https://starr-lab-server.usask.ca" ;
44 const serviceURL = `${ FRONTEND_URL } /cas-callback` ;
55
66 window . location . href = `${ CAS_SERVER } /login?service=${ encodeURIComponent (
You can’t perform that action at this time.
0 commit comments