Skip to content

Commit e083690

Browse files
committed
feat: disable auth guard and fix feedback proxy URL
1 parent 40fdeb6 commit e083690

3 files changed

Lines changed: 3 additions & 51 deletions

File tree

echo-server.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/auth/auth.guard.ts

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/feedback/feedback.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class FeedbackController {
1515
try {
1616
const result = await this.proxy.forward({
1717
service: 'COSA',
18-
url: `${this.COSA_API}/view-feedbacks`,
18+
url: `${this.COSA_API}/view-feedback`,
1919
method: 'GET',
2020
headers: req.headers,
2121
params: { ...(req.query as any) },

0 commit comments

Comments
 (0)