mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Refactor and move session logic into app package * Refactor email functions into the app package * Refactor password update into app package * Migrate user functions to app package * Move team functions into app package * Migrate channel functions into app package * Pass SiteURL through to app functions * Update based on feedback
35 lines
948 B
Go
35 lines
948 B
Go
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package app
|
|
|
|
import (
|
|
"github.com/mattermost/platform/model"
|
|
)
|
|
|
|
func RevokeAccessToken(token string) *model.AppError {
|
|
|
|
session, _ := GetSession(token)
|
|
schan := Srv.Store.Session().Remove(token)
|
|
|
|
if result := <-Srv.Store.OAuth().GetAccessData(token); result.Err != nil {
|
|
return model.NewLocAppError("RevokeAccessToken", "api.oauth.revoke_access_token.get.app_error", nil, "")
|
|
}
|
|
|
|
tchan := Srv.Store.OAuth().RemoveAccessData(token)
|
|
|
|
if result := <-tchan; result.Err != nil {
|
|
return model.NewLocAppError("RevokeAccessToken", "api.oauth.revoke_access_token.del_token.app_error", nil, "")
|
|
}
|
|
|
|
if result := <-schan; result.Err != nil {
|
|
return model.NewLocAppError("RevokeAccessToken", "api.oauth.revoke_access_token.del_session.app_error", nil, "")
|
|
}
|
|
|
|
if session != nil {
|
|
ClearSessionCacheForUser(session.UserId)
|
|
}
|
|
|
|
return nil
|
|
}
|