Make docker Oauth endpoint configurable
This commit is contained in:
@@ -240,14 +240,18 @@ func initOauthProviders(p *types.Playground) {
|
|||||||
config.Providers[p.Id]["facebook"] = conf
|
config.Providers[p.Id]["facebook"] = conf
|
||||||
}
|
}
|
||||||
if p.DockerClientID != "" && p.DockerClientSecret != "" {
|
if p.DockerClientID != "" && p.DockerClientSecret != "" {
|
||||||
oauth2.RegisterBrokenAuthHeaderProvider(".id.docker.com")
|
endpoint := "id.docker.com"
|
||||||
|
if len(p.DockerHost) > 0 {
|
||||||
|
endpoint = p.DockerHost
|
||||||
|
}
|
||||||
|
oauth2.RegisterBrokenAuthHeaderProvider(fmt.Sprintf(".%s", endpoint))
|
||||||
conf := &oauth2.Config{
|
conf := &oauth2.Config{
|
||||||
ClientID: p.DockerClientID,
|
ClientID: p.DockerClientID,
|
||||||
ClientSecret: p.DockerClientSecret,
|
ClientSecret: p.DockerClientSecret,
|
||||||
Scopes: []string{"openid"},
|
Scopes: []string{"openid"},
|
||||||
Endpoint: oauth2.Endpoint{
|
Endpoint: oauth2.Endpoint{
|
||||||
AuthURL: "https://id.docker.com/id/oauth/authorize/",
|
AuthURL: fmt.Sprintf("https://%s/id/oauth/authorize/", endpoint),
|
||||||
TokenURL: "https://id.docker.com/id/oauth/token",
|
TokenURL: fmt.Sprintf("https://%s/id/oauth/token", endpoint),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,5 +87,6 @@ type Playground struct {
|
|||||||
FacebookClientSecret string `json:"facebook_client_secret" bson:"facebook_client_secret"`
|
FacebookClientSecret string `json:"facebook_client_secret" bson:"facebook_client_secret"`
|
||||||
DockerClientID string `json:"docker_client_id" bson:"docker_client_id"`
|
DockerClientID string `json:"docker_client_id" bson:"docker_client_id"`
|
||||||
DockerClientSecret string `json:"docker_client_secret" bson:"docker_client_secret"`
|
DockerClientSecret string `json:"docker_client_secret" bson:"docker_client_secret"`
|
||||||
|
DockerHost string `json:"docker_host" bson:"docker_host"`
|
||||||
MaxInstances int `json:"max_instances" bson:"max_instances"`
|
MaxInstances int `json:"max_instances" bson:"max_instances"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user