mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(server): auth strategies (#1459)
* fix(server): auth strategies * chore: tests
This commit is contained in:
parent
5939d79057
commit
414893a687
9 changed files with 24 additions and 37 deletions
|
|
@ -115,10 +115,10 @@ export class AuthService {
|
|||
}
|
||||
}
|
||||
|
||||
public async validate(headers: IncomingHttpHeaders): Promise<AuthUserDto> {
|
||||
public async validate(headers: IncomingHttpHeaders): Promise<AuthUserDto | null> {
|
||||
const tokenValue = this.extractTokenFromHeader(headers);
|
||||
if (!tokenValue) {
|
||||
throw new UnauthorizedException('No access token provided in request');
|
||||
return null;
|
||||
}
|
||||
|
||||
const hashedToken = this.cryptoRepository.hashSha256(tokenValue);
|
||||
|
|
@ -133,7 +133,7 @@ export class AuthService {
|
|||
};
|
||||
}
|
||||
|
||||
throw new UnauthorizedException('Invalid access token provided');
|
||||
return null;
|
||||
}
|
||||
|
||||
extractTokenFromHeader(headers: IncomingHttpHeaders) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue