summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorChris Duarte <csduarte@users.noreply.github.com>2018-07-18 14:56:38 -0700
committerChristopher Speller <crspeller@gmail.com>2018-07-18 14:56:38 -0700
commit3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e (patch)
treecfb316b15d34d9242b5db41e76f1161e08813444 /web
parent6b27b74f0cbd39e5d1400cddbed6437a4df64856 (diff)
downloadchat-3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.tar.gz
chat-3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.tar.bz2
chat-3fcecd521a5c6ccfdb52fb4c3fb1f8c6ea528a4e.zip
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
Diffstat (limited to 'web')
-rw-r--r--web/saml.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/web/saml.go b/web/saml.go
index 9cf93bdab..f5400a378 100644
--- a/web/saml.go
+++ b/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)
}