Skip to content

Commit

Permalink
fix: cleanup authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
holdan-8 committed May 29, 2024
1 parent bf9ce2a commit 494f7f1
Show file tree
Hide file tree
Showing 4 changed files with 321 additions and 5 deletions.
3 changes: 2 additions & 1 deletion oss-api/src/auth/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import {
} from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { Request } from 'express';
import { jwtConstants } from './constants';

@Injectable()
export class AuthGuard implements CanActivate {
constructor(private jwtService: JwtService) {
this.jwtSecret = process.env.JWT_SECRET;
this.jwtSecret = jwtConstants.secret;
}

private jwtSecret: string;
Expand Down
7 changes: 4 additions & 3 deletions oss-api/src/auth/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dotenv/config';

export const jwtConstants = {
//TODO: change sectret, save it in an appropriate way, anina
secret:
'DO NOT USE THIS VALUE. INSTEAD, CREATE A COMPLEX SECRET AND KEEP IT SAFE OUTSIDE OF THE SOURCE CODE.',
//TODO: change sectret, save it in an appropriate way, anina schauen ob dieses überhaupt gebraucht wird
secret: process.env.JWT_SECRET,
};
Loading

0 comments on commit 494f7f1

Please sign in to comment.