Accept unsigned TLS certs for SSO and outgoing hooks, also fix delete hooks bug
Этот коммит содержится в:
@@ -4,6 +4,7 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
l4g "github.com/alecthomas/log4go"
|
l4g "github.com/alecthomas/log4go"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
@@ -401,7 +402,11 @@ func handleWebhookEventsAndForget(c *Context, post *model.Post, team *model.Team
|
|||||||
p.Set("text", post.Message)
|
p.Set("text", post.Message)
|
||||||
p.Set("trigger_word", firstWord)
|
p.Set("trigger_word", firstWord)
|
||||||
|
|
||||||
client := &http.Client{}
|
// accept any TLS certs
|
||||||
|
tr := &http.Transport{
|
||||||
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||||
|
}
|
||||||
|
client := &http.Client{Transport: tr}
|
||||||
|
|
||||||
for _, url := range hook.CallbackURLs {
|
for _, url := range hook.CallbackURLs {
|
||||||
go func(url string) {
|
go func(url string) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"crypto/tls"
|
||||||
b64 "encoding/base64"
|
b64 "encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
l4g "github.com/alecthomas/log4go"
|
l4g "github.com/alecthomas/log4go"
|
||||||
@@ -1960,7 +1961,11 @@ func AuthorizeOAuthUser(service, code, state, redirectUri string) (io.ReadCloser
|
|||||||
p.Set("grant_type", model.ACCESS_TOKEN_GRANT_TYPE)
|
p.Set("grant_type", model.ACCESS_TOKEN_GRANT_TYPE)
|
||||||
p.Set("redirect_uri", redirectUri)
|
p.Set("redirect_uri", redirectUri)
|
||||||
|
|
||||||
client := &http.Client{}
|
// accept any TLS certs
|
||||||
|
tr := &http.Transport{
|
||||||
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||||
|
}
|
||||||
|
client := &http.Client{Transport: tr}
|
||||||
req, _ := http.NewRequest("POST", sso.TokenEndpoint, strings.NewReader(p.Encode()))
|
req, _ := http.NewRequest("POST", sso.TokenEndpoint, strings.NewReader(p.Encode()))
|
||||||
|
|
||||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ func getOutgoingHooks(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func deleteOutgoingHook(c *Context, w http.ResponseWriter, r *http.Request) {
|
func deleteOutgoingHook(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
if !utils.Cfg.ServiceSettings.EnableIncomingWebhooks {
|
if !utils.Cfg.ServiceSettings.EnableOutgoingWebhooks {
|
||||||
c.Err = model.NewLocAppError("deleteOutgoingHook", "api.webhook.delete_outgoing.disabled.app_error", nil, "")
|
c.Err = model.NewLocAppError("deleteOutgoingHook", "api.webhook.delete_outgoing.disabled.app_error", nil, "")
|
||||||
c.Err.StatusCode = http.StatusNotImplemented
|
c.Err.StatusCode = http.StatusNotImplemented
|
||||||
return
|
return
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user