File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -83,11 +83,11 @@ export default function adminRouter(dbController: DatabaseController): Router {
8383 res . status ( 403 ) . json ( { error : "Access denied" } ) ;
8484 }
8585 const token = jwt . sign (
86- { username : casData . user , roles : casData . roles } ,
86+ { username : nsid } ,
8787 process . env . JWT_SECRET ! ,
8888 { expiresIn : "3h" } ,
8989 ) ;
90- res . json ( { token} ) ;
90+ res . json ( { token : token , nsid : nsid } ) ;
9191 } else {
9292 res . status ( 401 ) . json ( { error : 'CAS authentication failed' } ) ;
9393
Original file line number Diff line number Diff line change @@ -16,8 +16,10 @@ const CASCallback: React.FC = () => {
1616 return response . json ( ) } )
1717 . then ( ( data ) => {
1818 if ( data . token ) {
19- // Store JWT in localStorage or cookies
19+ // Store JWT in localStorage
2020 localStorage . setItem ( 'jwt' , data . token ) ;
21+ // Store nsid in localStorage
22+ localStorage . setItem ( 'nsid' , data . nsid ) ;
2123 // Redirect to a protected page or home
2224 window . location . href = '/' ;
2325 } else {
You can’t perform that action at this time.
0 commit comments