2.0.19 • Published 12 months ago

@buildery/nest-jwt v2.0.19

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

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.19

12 months ago

2.0.17

1 year ago

2.0.18

12 months ago

2.0.16

1 year ago

2.0.15

1 year ago

2.0.14

1 year ago

2.0.13

1 year ago

2.0.11

1 year ago

2.0.12

1 year ago

2.0.9

1 year ago

2.0.5

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.8

1 year ago

2.0.3

1 year ago

2.0.4

1 year ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

2.0.2

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

2.0.1

2 years ago

1.0.13

2 years ago

2.0.0

2 years ago

1.0.12

2 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago