Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass optional connector_id to cluster_context #146

Merged
merged 2 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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