Skip to content

Commit

Permalink
Make docker Oauth endpoint configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnils committed Mar 31, 2019
1 parent 9191273 commit 40197c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions handlers/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,18 @@ func initOauthProviders(p *types.Playground) {
config.Providers[p.Id]["facebook"] = conf
}
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{
ClientID: p.DockerClientID,
ClientSecret: p.DockerClientSecret,
Scopes: []string{"openid"},
Endpoint: oauth2.Endpoint{
AuthURL: "https://id.docker.com/id/oauth/authorize/",
TokenURL: "https://id.docker.com/id/oauth/token",
AuthURL: fmt.Sprintf("https://%s/id/oauth/authorize/", endpoint),
TokenURL: fmt.Sprintf("https://%s/id/oauth/token", endpoint),
},
}

Expand Down
1 change: 1 addition & 0 deletions pwd/types/playground.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@ type Playground struct {
FacebookClientSecret string `json:"facebook_client_secret" bson:"facebook_client_secret"`
DockerClientID string `json:"docker_client_id" bson:"docker_client_id"`
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"`
}

0 comments on commit 40197c4

Please sign in to comment.