Skip to content

Commit 1e0f72f

Browse files
authored
docs(authentication): update construction service declarations to match current implementation
1 parent 03323c5 commit 1e0f72f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

content/security/authentication.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ import { UsersService } from '../users/users.service';
111111

112112
@Injectable()
113113
export class AuthService {
114-
constructor(private usersService: UsersService) {}
114+
constructor(private readonly usersService: UsersService) {}
115115

116116
async signIn(username: string, pass: string): Promise<any> {
117117
const user = await this.usersService.findOne(username);
@@ -188,7 +188,7 @@ import { AuthService } from './auth.service';
188188

189189
@Controller('auth')
190190
export class AuthController {
191-
constructor(private authService: AuthService) {}
191+
constructor(private readonly authService: AuthService) {}
192192

193193
@HttpCode(HttpStatus.OK)
194194
@Post('login')
@@ -373,7 +373,7 @@ import { Request } from 'express';
373373

374374
@Injectable()
375375
export class AuthGuard implements CanActivate {
376-
constructor(private jwtService: JwtService) {}
376+
constructor(private readonly jwtService: JwtService) {}
377377

378378
async canActivate(context: ExecutionContext): Promise<boolean> {
379379
const request = context.switchToHttp().getRequest();
@@ -425,7 +425,7 @@ import { AuthService } from './auth.service';
425425

426426
@Controller('auth')
427427
export class AuthController {
428-
constructor(private authService: AuthService) {}
428+
constructor(private readonly authService: AuthService) {}
429429

430430
@HttpCode(HttpStatus.OK)
431431
@Post('login')
@@ -506,7 +506,7 @@ Lastly, we need the `AuthGuard` to return `true` when the `"isPublic"` metadata
506506
```typescript
507507
@Injectable()
508508
export class AuthGuard implements CanActivate {
509-
constructor(private jwtService: JwtService, private reflector: Reflector) {}
509+
constructor(private readonly jwtService: JwtService, private reflector: Reflector) {}
510510

511511
async canActivate(context: ExecutionContext): Promise<boolean> {
512512
const isPublic = this.reflector.getAllAndOverride<boolean>(IS_PUBLIC_KEY, [

0 commit comments

Comments
 (0)