File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ module.exports = [
3232 } )
3333 . then ( ( copilotOpportunity ) => {
3434 const plainOpportunity = copilotOpportunity . get ( { plain : true } ) ;
35+ req . log . info ( "authUser" , req . authUser ) ;
3536 const memberIds = plainOpportunity . project . members . map ( ( member ) => member . userId ) ;
3637 // This shouldn't be exposed to the clientside
3738 delete plainOpportunity . project . members ;
Original file line number Diff line number Diff line change @@ -35,9 +35,14 @@ const jwtAuth = require('tc-core-library-js').middleware.jwtAuthenticator;
3535router . all (
3636 RegExp ( `\\/${ apiVersion } \\/(copilots|projects|timelines|orgConfig|customer-payments)(?!\\/health).*` ) ,
3737 ( req , res , next ) => {
38- if ( publicRoutes . some ( routeRegex => routeRegex . test ( req . path ) ) ) {
38+ let token
39+ if ( req . headers . authorization && req . headers . authorization . split ( ' ' ) [ 0 ] === 'Bearer' ) {
40+ token = req . headers . authorization . split ( ' ' ) [ 1 ]
41+ }
42+ if ( publicRoutes . some ( routeRegex => routeRegex . test ( req . path ) ) && ! token ) {
3943 return next ( ) ;
4044 }
45+ req . log . info ( "token available" , token ) ;
4146 // JWT authentication
4247 return jwtAuth ( config ) ( req , res , next ) ;
4348 } ,
You can’t perform that action at this time.
0 commit comments