destroyAllSessions static method
Future<void>
destroyAllSessions(
- Session session, {
- required UuidValue authUserId,
- Transaction? transaction,
Signs out a user from the server and ends all user sessions managed by this module.
This means that all sessions connected to the user will be terminated.
Note: The method will not do anything if no authentication information is found for the user.
Implementation
static Future<void> destroyAllSessions(
final Session session, {
required final UuidValue authUserId,
final Transaction? transaction,
}) async {
// Delete all sessions for the user
final auths = await AuthSession.db.deleteWhere(
session,
where: (final row) => row.authUserId.equals(authUserId),
transaction: transaction,
);
if (auths.isEmpty) return;
await session.messages.authenticationRevoked(
authUserId.uuid,
RevokedAuthenticationUser(),
);
}