Support periodic auth checks in SecurityContext on web socket connections
This commit is contained in:
@@ -80,6 +80,9 @@ export abstract class SecurityContext {
|
||||
/**
|
||||
* Assuming a user is still authenticated in the context,
|
||||
* try to look up and fill in the user.
|
||||
*
|
||||
* If there is NO USER to be resumed, then the method should flush
|
||||
* the user from this context.
|
||||
*/
|
||||
abstract resume(): Awaitable<void>
|
||||
|
||||
|
||||
@@ -33,7 +33,10 @@ export class SessionSecurityContext extends SecurityContext {
|
||||
if ( user ) {
|
||||
this.authenticatedUser = user
|
||||
await this.bus.push(new UserAuthenticationResumedEvent(user, this))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
this.authenticatedUser = undefined
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ export class TokenSecurityContext extends SecurityContext {
|
||||
if ( user ) {
|
||||
this.authenticatedUser = user
|
||||
await this.bus.push(new UserAuthenticationResumedEvent(user, this))
|
||||
return
|
||||
}
|
||||
|
||||
this.authenticatedUser = undefined
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user