Jelajahi Sumber

feat(core): Pass RequestContext to AuthenticationStrategy.onLogOut()

BREAKING CHANGE: The `AuthenticationStrategy.onLogOut()` function
signature has changed: the first argument is now the RequestContext of the current request.
Michael Bromley 5 tahun lalu
induk
melakukan
a46ea5db45

+ 1 - 1
packages/core/src/config/auth/authentication-strategy.ts

@@ -72,5 +72,5 @@ export interface AuthenticationStrategy<Data = unknown> extends InjectableStrate
      * Called when a user logs out, and may perform any required tasks
      * related to the user logging out with the external provider.
      */
-    onLogOut?(user: User): Promise<void>;
+    onLogOut?(ctx: RequestContext, user: User): Promise<void>;
 }

+ 1 - 1
packages/core/src/service/services/auth.service.ts

@@ -134,7 +134,7 @@ export class AuthService {
                 session.authenticationStrategy,
             );
             if (typeof authenticationStrategy.onLogOut === 'function') {
-                await authenticationStrategy.onLogOut(session.user);
+                await authenticationStrategy.onLogOut(ctx, session.user);
             }
             this.eventBus.publish(new LogoutEvent(ctx));
             return this.sessionService.deleteSessionsByUser(ctx, session.user);