Add ability to configure auth redirect url per playground
This commit is contained in:
@@ -73,6 +73,9 @@ func Login(rw http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if playground.AuthRedirectURL != "" {
|
||||
provider.RedirectURL = playground.AuthRedirectURL
|
||||
} else {
|
||||
scheme := "http"
|
||||
if req.TLS != nil {
|
||||
scheme = "https"
|
||||
@@ -82,6 +85,8 @@ func Login(rw http.ResponseWriter, req *http.Request) {
|
||||
host = req.Host
|
||||
}
|
||||
provider.RedirectURL = fmt.Sprintf("%s://%s/oauth/providers/%s/callback", scheme, host, providerName)
|
||||
}
|
||||
|
||||
url := provider.AuthCodeURL(loginRequest.Id, oauth2.SetAuthURLParam("nonce", uuid.NewV4().String()))
|
||||
|
||||
http.Redirect(rw, req, url, http.StatusFound)
|
||||
|
||||
@@ -88,6 +88,7 @@ type Playground struct {
|
||||
GoogleClientSecret string `json:"google_client_secret" bson:"google_client_secret"`
|
||||
DockerClientID string `json:"docker_client_id" bson:"docker_client_id"`
|
||||
DockerClientSecret string `json:"docker_client_secret" bson:"docker_client_secret"`
|
||||
AuthRedirectURL string `json:"auth_redirect_url" bson:"auth_redirect_url"`
|
||||
DockerHost string `json:"docker_host" bson:"docker_host"`
|
||||
MaxInstances int `json:"max_instances" bson:"max_instances"`
|
||||
Privileged bool `json:"privileged" bson:"privileged"`
|
||||
|
||||
Reference in New Issue
Block a user