2.0.16 • Published 24 days ago
@buildery/nest-jwt v2.0.16
Description
Nestjs implementations for Auth (Bearer: Access Token):
- Decorators
- Guards
- Services
Decorators:
- AccessTokenInfo
async init(@AccessTokenInfo('username') username: string) {
await this.service.run(username);
}
Jwt Service Implementation
Extend JwtTokenService to apply your secret and expiresIn
@Injectable()
export class WorkspaceTokenService extends JwtTokenService {
constructor(private configService: ConfigService) {
super(
configService ? configService.get('JWT_WORKSPACE_TOKEN_SECRET') : process.env.JWT_WORKSPACE_TOKEN_SECRET,
configService ? configService.get('JWT_WORKSPACE_TOKEN_EXPIRESIN') : process.env.JWT_WORKSPACE_TOKEN_EXPIRESIN,
ETokenType.Workspace
);
}
}
Auth Guard implementation:
@Injectable()
export class WorkspaceAuthGuard extends AuthGuard(WorkspaceTokenService){}
Use Auth Guard implementation:
@UseGuards(WorkspaceAuthGuard)
@Controller('permission')
export class PermissionController {
}
Nest framework TypeScript starter repository.
Use
installation
$ npm install @builder/nest-utils
2.0.16
24 days ago
2.0.15
2 months ago
2.0.14
2 months ago
2.0.13
2 months ago
2.0.11
2 months ago
2.0.12
2 months ago
2.0.9
2 months ago
2.0.5
2 months ago
2.0.7
2 months ago
2.0.6
2 months ago
2.0.8
2 months ago
2.0.3
2 months ago
2.0.4
2 months ago
1.0.19
7 months ago
1.0.18
7 months ago
1.0.17
7 months ago
1.0.16
7 months ago
2.0.2
7 months ago
1.0.11
7 months ago
1.0.10
7 months ago
1.0.15
7 months ago
1.0.14
7 months ago
2.0.1
7 months ago
1.0.13
7 months ago
2.0.0
7 months ago
1.0.12
7 months ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago