Skip to content

Commit

Permalink
Request acr_values for authorization flow (#73)
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Bilski <[email protected]>
  • Loading branch information
ikawalec and mbilski authored Sep 15, 2023
1 parent 5e36210 commit f0e3ec8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func LogInputData(cc oauth2.ClientConfig) {
{"Grant type", cc.GrantType},
{"Auth method", cc.AuthMethod},
{"Scopes", strings.Join(cc.Scopes, ", ")},
{"ACR Values", strings.Join(cc.ACRValues, ", ")},
{"Audience", strings.Join(cc.Audience, ", ")},
{"Response types", strings.Join(cc.ResponseType, ", ")},
{"Response mode", cc.ResponseMode},
Expand Down
1 change: 1 addition & 0 deletions cmd/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func NewOAuth2Cmd() (cmd *OAuth2Cmd) {
cmd.PersistentFlags().BoolVar(&cconfig.DPoP, "dpop", false, "use DPoP")
cmd.PersistentFlags().StringVar(&cconfig.Claims, "claims", "", "use claims")
cmd.PersistentFlags().StringVar(&cconfig.RAR, "rar", "", "use rich authorization request (RAR)")
cmd.PersistentFlags().StringSliceVar(&cconfig.ACRValues, "acr-values", []string{}, "ACR values")

return cmd
}
Expand Down
1 change: 1 addition & 0 deletions internal/oauth2/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type ClientConfig struct {
ClientID string
ClientSecret string
Scopes []string
ACRValues []string
Audience []string
AuthMethod string
PKCE bool
Expand Down
8 changes: 8 additions & 0 deletions internal/oauth2/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (r *Request) AuthorizeRequest(
r.Form.Set("scope", strings.Join(cconfig.Scopes, " "))
}

if len(cconfig.ACRValues) > 0 {
r.Form.Set("acr_values", strings.Join(cconfig.ACRValues, " "))
}

if len(cconfig.Audience) > 0 {
r.Form.Set("audience", strings.Join(cconfig.Audience, " "))
}
Expand Down Expand Up @@ -121,6 +125,10 @@ func (r *Request) AuthorizeRequest(
r.Form.Set("scope", strings.Join(cconfig.Scopes, " "))
}

if len(cconfig.ACRValues) > 0 {
r.Form.Set("acr_values", strings.Join(cconfig.ACRValues, " "))
}

if len(cconfig.Audience) > 0 {
r.Form.Set("audience", strings.Join(cconfig.Audience, " "))
}
Expand Down

0 comments on commit f0e3ec8

Please sign in to comment.