@@ -15,44 +15,8 @@ export class AuthGuard implements CanActivate {
1515 constructor ( ) { }
1616
1717 async canActivate ( context : ExecutionContext ) : Promise < boolean > {
18- const request = context . switchToHttp ( ) . getRequest ( ) ;
19- const token = this . extractTokenFromHeader ( request ) ;
20-
21- if ( ! token ) {
22- throw new UnauthorizedException ( 'Missing token' ) ;
23- }
24-
25- try {
26- // Dynamic import for ESM compatibility in Vercel/CommonJS environment
27- const jose = await import ( 'jose' ) ;
28-
29- if ( ! this . JWKS ) {
30- const authUrl = process . env . AUTH_SERVICE_URL || 'https://auth.openlake.in' ;
31- this . JWKS = jose . createRemoteJWKSet ( new URL ( `${ authUrl } /.well-known/jwks.json` ) ) ;
32- }
33-
34- const { payload } = await jose . jwtVerify ( token , this . JWKS , {
35- issuer : process . env . AUTH_ISSUER || 'openlake-auth' ,
36- } ) ;
37-
38- // Attach user to request
39- request [ 'user' ] = payload ;
40-
41- // Inject headers for downstream
42- request . headers [ 'x-openlake-user-id' ] = payload . sub as string ;
43- request . headers [ 'x-openlake-role' ] = payload . role as string ;
44- request . headers [ 'x-openlake-scopes' ] = Array . isArray ( payload . scope )
45- ? payload . scope . join ( ' ' )
46- : ( payload . scope as string || '' ) ;
47-
48- // Request ID (Fastify usually has req.id, but let's ensure we propogate it or generate one)
49- request . headers [ 'x-openlake-request-id' ] = ( request as any ) . id || crypto . randomUUID ( ) ;
50-
51- return true ;
52- } catch ( e ) {
53- this . logger . error ( `Token verification failed: ${ e . message } ` ) ;
54- throw new UnauthorizedException ( ) ;
55- }
18+ // Authentication has been disabled as per request
19+ return true ;
5620 }
5721
5822
0 commit comments