You've already forked focalboard
mirror of
https://github.com/mattermost/focalboard.git
synced 2025-07-06 23:36:34 +02:00
Changing mattermost-auth method to work based on shared database access (#335)
* Improving mattermost auth implementation * Making mattermost-auth based on shared database access * Reverting unneeded changes in the config.json file * Fixing tiny problems * Removing the need of using the mattermost session token * Fixing some bugs and allowing to not-bind the server to any port * Small fix to correctly get the templates * Adding the mattermost-plugin code inside focalboard repo * Adding a not working code part of the cluster websocket communication * Updating the mattermost version * Adding the cluster messages for the websockets * Updating to the new node version * Making it compatible with S3 * Addressing some tiny problems * Fixing server tests * Adds support for MySQL migrations and initialization Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
This commit is contained in:
@ -371,6 +371,23 @@ func (a *API) attachSession(handler func(w http.ResponseWriter, r *http.Request)
|
||||
return
|
||||
}
|
||||
|
||||
if a.MattermostAuth && r.Header.Get("Mattermost-User-Id") != "" {
|
||||
userID := r.Header.Get("Mattermost-User-Id")
|
||||
now := time.Now().Unix()
|
||||
session := &model.Session{
|
||||
ID: userID,
|
||||
Token: userID,
|
||||
UserID: userID,
|
||||
AuthService: a.authService,
|
||||
Props: map[string]interface{}{},
|
||||
CreateAt: now,
|
||||
UpdateAt: now,
|
||||
}
|
||||
ctx := context.WithValue(r.Context(), "session", session)
|
||||
handler(w, r.WithContext(ctx))
|
||||
return
|
||||
}
|
||||
|
||||
session, err := a.app().GetSession(token)
|
||||
if err != nil {
|
||||
if required {
|
||||
|
Reference in New Issue
Block a user