diff --git a/daemon/rpc_logout.go b/daemon/rpc_logout.go index f0a27c95..e94433d7 100644 --- a/daemon/rpc_logout.go +++ b/daemon/rpc_logout.go @@ -57,7 +57,7 @@ func (r *RPC) Logout(ctx context.Context, in *pb.LogoutRequest) (payload *pb.Pay return &pb.Payload{Type: internal.CodeFailure}, nil } - if !r.ncClient.Revoke(internal.IsDevEnv(string(r.environment))) { + if !r.ncClient.Revoke() { log.Println(internal.WarningPrefix, "error revoking NC token") } diff --git a/daemon/rpc_logout_test.go b/daemon/rpc_logout_test.go index 62683c25..c791b8c9 100644 --- a/daemon/rpc_logout_test.go +++ b/daemon/rpc_logout_test.go @@ -23,8 +23,8 @@ type mockNC struct { nc.NotificationClient } -func (mockNC) Stop() error { return nil } -func (mockNC) Revoke(bool) bool { return true } +func (mockNC) Stop() error { return nil } +func (mockNC) Revoke() bool { return true } type mockApi struct { core.CombinedAPI diff --git a/daemon/rpc_set_defaults.go b/daemon/rpc_set_defaults.go index 35c558b3..f0206495 100644 --- a/daemon/rpc_set_defaults.go +++ b/daemon/rpc_set_defaults.go @@ -30,10 +30,8 @@ func (r *RPC) SetDefaults(ctx context.Context, in *pb.Empty) (*pb.Payload, error log.Println(internal.WarningPrefix, err) } - if internal.IsDevEnv(string(r.environment)) { - if !r.ncClient.Revoke(true) { - log.Println(internal.WarningPrefix, "error revoking token") - } + if !r.ncClient.Revoke() { + log.Println(internal.WarningPrefix, "error revoking token") } if err := r.cm.Reset(); err != nil { diff --git a/nc/nc.go b/nc/nc.go index 59932ce9..a9e82a2c 100644 --- a/nc/nc.go +++ b/nc/nc.go @@ -103,7 +103,7 @@ type AcknowledgementPayload struct { type NotificationClient interface { Start() error Stop() error - Revoke(bool) bool + Revoke() bool } type ClientBuilder interface { @@ -542,7 +542,7 @@ func (c *Client) Stop() error { } // Revoke revokes the NC communication token -func (c *Client) Revoke(purgeSession bool) bool { +func (c *Client) Revoke() bool { c.startMu.Lock() defer c.startMu.Unlock() @@ -551,8 +551,7 @@ func (c *Client) Revoke(purgeSession bool) bool { return false } - log.Println(logPrefix, "revoking token, purgeSession:", purgeSession) - ok, err := c.credsFetcher.RevokeCredentials(purgeSession) + ok, err := c.credsFetcher.RevokeCredentials(true) if ok { log.Println(logPrefix, "token revoked successfully") return true