some changes
This commit is contained in:
parent
3b3fa2a7de
commit
6e05c990d1
@ -15,6 +15,7 @@ export class CSRFMiddleware implements NestMiddleware {
|
||||
res.cookie('XSRF', secretToken, {
|
||||
maxAge: 60 * 60 * 1000,
|
||||
secure: !DEV,
|
||||
httpOnly: true,
|
||||
sameSite: 'strict',
|
||||
});
|
||||
}
|
||||
|
@ -8,3 +8,13 @@ export class Privilege {
|
||||
@Column({ type: 'text', nullable: false })
|
||||
name: string;
|
||||
}
|
||||
|
||||
/*
|
||||
Initial entries:
|
||||
admin
|
||||
admin:user
|
||||
admin:user:privilege
|
||||
admin:document
|
||||
admin:oauth2
|
||||
self: oauth2
|
||||
*/
|
||||
|
@ -16,10 +16,14 @@ export class OAuth2RouterModule implements NestModule {
|
||||
constructor(private _service: OAuth2Service) {}
|
||||
|
||||
configure(consumer: MiddlewareConsumer) {
|
||||
consumer.apply(CSRFMiddleware, UserMiddleware).forRoutes(OAuth2Controller);
|
||||
consumer.apply(this._service.oauth.express()).forRoutes('oauth2/*');
|
||||
consumer
|
||||
.apply(AuthMiddleware, ValidateCSRFMiddleware)
|
||||
.apply(
|
||||
CSRFMiddleware,
|
||||
UserMiddleware,
|
||||
AuthMiddleware,
|
||||
ValidateCSRFMiddleware,
|
||||
)
|
||||
.forRoutes('oauth2/authorize');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user