chore(CookieService): remove unused CookieGuard

This commit is contained in:
Pujit Mehrotra
2024-10-08 13:15:03 -04:00
parent e61d9f195d
commit 5034a8981a
2 changed files with 0 additions and 27 deletions

View File

@@ -1,7 +0,0 @@
import { CookieGuard } from './cookie.guard';
describe('CookieGuard', () => {
it('should be defined', () => {
expect(new CookieGuard()).toBeDefined();
});
});

View File

@@ -1,20 +0,0 @@
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
import { Observable } from 'rxjs';
import { CookieService } from './cookie.service';
@Injectable()
export class CookieGuard implements CanActivate {
constructor(private service: CookieService) {}
/**
* Checks if the request contains a valid unraid session cookie.
*
* If it does, it means the user is logged into their unraid server.
* They should be allowed to access it from an any domain, regardless of CORS
* (although that logic doesn't happen here).
*/
canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean> {
const request = context.switchToHttp().getRequest();
return this.service.hasValidAuthCookie(request.cookies);
}
}