mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Support for Embeded chat (#9129)
* Add ucLive support crazy testing lovely logs more cookie work arounds Added Access-Control-Expose-Headers to user login Add complete_saml_body template and revert loginWithSaml endpoint Set Access-Control-Allow-Credentials to true in user login Login via email instead of username Clean up code Add comment to give some context Move faml logic into saml function Communicate via chrome sendMessage api Remove unused code Add config to support multiple extensions Clean up embedded complete_saml template Fix indentation for templates Added license header to extension.go Add EnableExperimentalExtensions flag Extension validated for email auth Clean up api auth code Remove complete_saml_body.html * Add extension support in saml * Clean up code * Clean up extension validation
This commit is contained in:
committed by
Christopher Speller
parent
6b27b74f0c
commit
3fcecd521a
17
web/saml.go
17
web/saml.go
@@ -32,6 +32,7 @@ func loginWithSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
action := r.URL.Query().Get("action")
|
||||
redirectTo := r.URL.Query().Get("redirect_to")
|
||||
extensionId := r.URL.Query().Get("extension_id")
|
||||
relayProps := map[string]string{}
|
||||
relayState := ""
|
||||
|
||||
@@ -47,6 +48,15 @@ func loginWithSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
relayProps["redirect_to"] = redirectTo
|
||||
}
|
||||
|
||||
if len(extensionId) != 0 {
|
||||
relayProps["extension_id"] = extensionId
|
||||
err := c.App.ValidateExtension(extensionId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if len(relayProps) > 0 {
|
||||
relayState = b64.StdEncoding.EncodeToString([]byte(model.MapToJson(relayProps)))
|
||||
}
|
||||
@@ -141,6 +151,13 @@ func completeSaml(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if action == model.OAUTH_ACTION_MOBILE {
|
||||
ReturnStatusOK(w)
|
||||
} else if action == model.OAUTH_ACTION_CLIENT {
|
||||
err = c.App.SendMessageToExtension(w, relayProps["extension_id"], c.Session.Token)
|
||||
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
} else {
|
||||
http.Redirect(w, r, c.GetSiteURLHeader(), http.StatusFound)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user