Skip to content

Commit

Permalink
Pass optional connector_id to cluster_context (#146)
Browse files Browse the repository at this point in the history
* Pass connector_id if it is not empty

* Update docs
  • Loading branch information
corest committed Nov 19, 2020
1 parent 5b86cdb commit 0e2a9e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dex-auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func (config *Config) handleIndex(w http.ResponseWriter, r *http.Request) {
func (cluster *Cluster) handleLogin(w http.ResponseWriter, r *http.Request) {
log.Printf("Handling login-uri for: %s", cluster.Name)
authCodeURL := cluster.oauth2Config().AuthCodeURL(exampleAppState, oauth2.AccessTypeOffline)
if cluster.Connector_ID != "" {
log.Printf("Using dex connector with id %#q", cluster.Connector_ID)
authCodeURL = fmt.Sprintf("%s&connector_id=%s", authCodeURL, cluster.Connector_ID)
}
log.Printf("Redirecting post-loginto: %s", authCodeURL)
http.Redirect(w, r, authCodeURL, http.StatusSeeOther)
}
Expand Down
1 change: 1 addition & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ An example configuration is available [here](../examples/config.yaml)
| description | yes | cluster | Extended description of cluster |
| client_secret | yes | cluster | OAuth2 client-secret (shared between dex-k8s-auth and dex) |
| client_id | yes | cluster | OAuth2 client-id public identifier (shared between dex-k8s-auth and dex) |
| connector_id | no | cluster | Dex connector ID to use by default omitting other available connectors |
| issuer | yes | cluster | Dex issuer url |
| redirect_uri | yes | cluster | Redirect uri called by dex (defines a callback on dex-k8s-auth) |
| k8s_master_uri | no | cluster | Kubernetes api-server endpoint (used in kubeconfig) |
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Cluster struct {
Issuer string
Client_Secret string
Client_ID string
Connector_ID string
K8s_Master_URI string
K8s_Ca_URI string
K8s_Ca_Pem string
Expand Down

0 comments on commit 0e2a9e3

Please sign in to comment.