updated accounts service navigator

This commit is contained in:
2025-08-03 18:23:26 +03:00
parent 1b87dee60d
commit aa8f0b8f31
24 changed files with 398 additions and 211 deletions

View File

@@ -4,7 +4,8 @@ import {
Injectable,
ForbiddenException,
} from '@nestjs/common';
import { RedisHandlers } from '@/src/utils/auth/redis_handlers';
import { RedisHandlers } from '@/src/utils/auth/redisHandlers';
import { UrlHandler } from '@/src/utils/auth/urlHandler';
@Injectable()
export class AuthControlGuard implements CanActivate {
@@ -13,25 +14,27 @@ export class AuthControlGuard implements CanActivate {
async canActivate(context: ExecutionContext): Promise<boolean> {
const req = context.switchToHttp().getRequest();
const accessToken = this.cacheService.mergeLoginKey(req);
console.log('AuthControlGuard', accessToken);
// console.log('AuthControlGuard', accessToken);
return true;
}
}
@Injectable()
export class EndpointControlGuard implements CanActivate {
constructor(private cacheService: RedisHandlers) { }
constructor(
private cacheService: RedisHandlers,
private urlHandler: UrlHandler,
) { }
async canActivate(context: ExecutionContext): Promise<boolean> {
const req = context.switchToHttp().getRequest();
// const selectToken = this.cacheService.mergeSelectKey(req);
const method = req.method;
const path = req.route?.path;
console.log('EndpointControlGuard', method, 'path', path);
// const accessObject = await this.cacheService.getSelectFromRedis(req);
// console.log('EndpointControlGuard', accessObject);
req.driveToken = "c5b6d9c7-9115-4825-bcc1-16f409a7004a"
// console.log('EndpointControlGuard', req.driveToken);
const keyUrl = `${path}:${method.toUpperCase()}`;
const driveToken = await this.urlHandler.getSecureUrlToken(keyUrl);
const accessObject = await this.cacheService.getSelectFromRedis(req);
req.driveToken = `${driveToken}:${accessObject?.value.functionsRetriever}`;
console.log('EndpointControlGuard driveToken: ', driveToken);
return true;
}
}