import { Context } from "@webiny/handler/types" ; export interface AuthenticationContext < TIdentity = Identity > extends Context { authentication : Authentication < TIdentity > ; } export interface Authenticator < TIdentity = Identity > { ( token ) : Promise < TIdentity > ; } export interface Authentication < TIdentity = Identity > { getIdentity < TIdentity extends Identity = Identity > ( ) : TIdentity ; setIdentity ( identity ) : void ; addAuthenticator ( authenticator ) : void ; getAuthenticators ( ) : Authenticator [ ] ; authenticate ( token ) : Promise < void > ; } export interface Identity { id : string ; type : string ; displayName : string ; [ key ] : any ; }