mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-10 23:24:32 +08:00
added check for http,https redirect
This commit is contained in:
parent
5322c44a99
commit
d1f02d0911
1 changed files with 11 additions and 1 deletions
12
auth/auth.go
12
auth/auth.go
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gravitl/netmaker/logic"
|
||||
"github.com/gravitl/netmaker/models"
|
||||
|
@ -60,7 +61,16 @@ func InitializeAuthProvider() string {
|
|||
return ""
|
||||
}
|
||||
var authInfo = servercfg.GetAuthProviderInfo()
|
||||
functions[init_provider].(func(string, string, string))(servercfg.GetAPIConnString()+"/api/oauth/callback", authInfo[1], authInfo[2])
|
||||
var serverConn = servercfg.GetAPIConnString()
|
||||
if strings.Contains(serverConn, "localhost") || strings.Contains(serverConn, "127.0.0.1") {
|
||||
logic.Log("localhost OAuth detected, proceeding with insecure http redirect", 1)
|
||||
serverConn = "http://" + serverConn
|
||||
} else {
|
||||
logic.Log("external OAuth detected, proceeding with https redirect", 1)
|
||||
serverConn = "https://" + serverConn
|
||||
}
|
||||
|
||||
functions[init_provider].(func(string, string, string))(serverConn+"/api/oauth/callback", authInfo[1], authInfo[2])
|
||||
return authInfo[0]
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue