Skip to content

Commit

Permalink
add config kc_idp_hint
Browse files Browse the repository at this point in the history
  • Loading branch information
moremagic committed Dec 10, 2019
1 parent 392d6ab commit 9d54abc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ type Resource struct {

// Config is the configuration for the proxy
type Config struct {
// IdpHint
IdpHint string `json:"idp-hint" yaml:"idp-hint" usage:"idp hint name configuration" env:"IDP_HINT"`
// ConfigFile is the binding interface
ConfigFile string `json:"config" yaml:"config" usage:"path the a configuration file" env:"CONFIG_FILE"`
// Listen is the binding interface
Expand Down
6 changes: 6 additions & 0 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ func (r *oauthProxy) oauthAuthorizationHandler(w http.ResponseWriter, req *http.
}

authURL := client.AuthCodeURL(req.URL.Query().Get("state"), accessType, "")
// idp_hint config
idpHint := r.config.IdpHint
if idpHint != "" {
authURL += "&kc_idp_hint=" + idpHint
}

r.log.Debug("incoming authorization request from client address",
zap.String("access_type", accessType),
zap.String("auth_url", authURL),
Expand Down

0 comments on commit 9d54abc

Please sign in to comment.