Skip to content

Commit

Permalink
Merge pull request #8 from simongottschlag/add_idtoken_response
Browse files Browse the repository at this point in the history
Add resource to ADFS redirect
  • Loading branch information
simongottschlag authored Feb 7, 2019
2 parents 08f946c + aa90268 commit 0400071
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ func loginURL(r *http.Request, state string) string {
}
} else if cfg.GenOAuth.Provider == cfg.Providers.IndieAuth {
url = cfg.OAuthClient.AuthCodeURL(state, oauth2.SetAuthURLParam("response_type", "id"))
} else if cfg.GenOAuth.Provider == cfg.Providers.ADFS {
url = cfg.OAuthClient.AuthCodeURL(state, cfg.OAuthopts)
} else {
url = cfg.OAuthClient.AuthCodeURL(state)
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/cfg/cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ func setDefaults() {
} else if GenOAuth.Provider == Providers.GitHub {
setDefaultsGitHub()
configureOAuthClient()
} else if GenOAuth.Provider == Providers.ADFS {
setDefaultsADFS()
configureOAuthClient()
} else {
configureOAuthClient()
}
Expand All @@ -449,6 +452,11 @@ func setDefaultsGoogle() {
}
}

func setDefaultsADFS() {
log.Info("configuring ADFS OAuth")
OAuthopts = oauth2.SetAuthURLParam("resource", GenOAuth.RedirectURL) // Needed or all claims won't be included
}

func setDefaultsGitHub() {
// log.Info("configuring GitHub OAuth")
if GenOAuth.AuthURL == "" {
Expand Down

0 comments on commit 0400071

Please sign in to comment.