Skip to content

Commit 24bd64b

Browse files
Merge pull request #3338 from Re9iNee/patch-1
docs(authentication): updating construction service declarations to match the previous docs
2 parents ce5243b + 1e0f72f commit 24bd64b

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')
@@ -376,7 +376,7 @@ import { Request } from 'express';
376376

377377
@Injectable()
378378
export class AuthGuard implements CanActivate {
379-
constructor(private jwtService: JwtService) {}
379+
constructor(private readonly jwtService: JwtService) {}
380380

381381
async canActivate(context: ExecutionContext): Promise<boolean> {
382382
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)