From b963030a0aa6ef8d49a67303b3ffcf00450d29eb Mon Sep 17 00:00:00 2001 From: Max Sandholm Date: Tue, 1 Aug 2023 15:32:28 +0300 Subject: [PATCH] Logout Slack user token on logout --- go.mod | 2 +- go.sum | 4 ++-- user.go | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3ed25f7..4c6d8d9 100644 --- a/go.mod +++ b/go.mod @@ -32,4 +32,4 @@ require ( maunium.net/go/mauflag v1.0.0 // indirect ) -replace github.com/slack-go/slack => github.com/beeper/slackgo v0.0.0-20230529112042-04e062c05e8b +replace github.com/slack-go/slack => github.com/beeper/slackgo v0.0.0-20230731145834-b294d2818e10 diff --git a/go.sum b/go.sum index 559e75b..e30b513 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= -github.com/beeper/slackgo v0.0.0-20230529112042-04e062c05e8b h1:SCBqU2C4ka1BZigu025aZGsTL62oJdlQFRWmzE/nWXg= -github.com/beeper/slackgo v0.0.0-20230529112042-04e062c05e8b/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= +github.com/beeper/slackgo v0.0.0-20230731145834-b294d2818e10 h1:E4pG1V8863lSopZMvzOTBmnbAsnrhKenMWgVaBu3iUw= +github.com/beeper/slackgo v0.0.0-20230731145834-b294d2818e10/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/user.go b/user.go index c763c68..956a620 100644 --- a/user.go +++ b/user.go @@ -363,6 +363,10 @@ func (user *User) LogoutUserTeam(userTeam *database.UserTeam) error { } } + if _, err := userTeam.Client.SendAuthSignout(); err != nil { + user.log.Errorfln("Failed to send auth.signout request to Slack! %v", err) + } + userTeam.Client = nil user.BridgeStates[userTeam.Key.TeamID].Send(status.BridgeState{StateEvent: status.StateLoggedOut})