You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
751 B
28 lines
751 B
import {Event} from '../../event/Event'
|
|
import {SecurityContext} from '../context/SecurityContext'
|
|
import {Awaitable, JSONState} from '../../util'
|
|
import {Authenticatable} from '../types'
|
|
|
|
/**
|
|
* Event fired when a user is authenticated.
|
|
*/
|
|
export class AuthenticationEvent extends Event {
|
|
constructor(
|
|
public readonly user: Authenticatable,
|
|
public readonly context: SecurityContext,
|
|
) {
|
|
super()
|
|
}
|
|
|
|
async dehydrate(): Promise<JSONState> {
|
|
return {
|
|
user: await this.user.dehydrate(),
|
|
contextName: this.context.name,
|
|
}
|
|
}
|
|
|
|
rehydrate(state: JSONState): Awaitable<void> { // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
// TODO fill this in
|
|
}
|
|
}
|