Skip to content
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
1 change: 1 addition & 0 deletions config/flipt.schema.cue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ JsonPath: string
nonce?: string
scopes?: [...string]
use_pkce?: bool
algorithms?: [...("RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512")] | *["RS256"]
}

}
Expand Down
23 changes: 23 additions & 0 deletions config/flipt.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,29 @@
"use_pkce": {
"type": "boolean",
"default": false
},
"algorithms": {
"type": [
"array",
"null"
],
"items": {
"type": "string",
"enum": [
"RS256",
"RS384",
"RS512",
"ES256",
"ES384",
"ES512",
"PS256",
"PS384",
"PS512"
]
},
"default": [
"RS256"
]
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions internal/config/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,12 @@ type AuthenticationMethodOIDCProvider struct {
Nonce string `json:"nonce,omitempty" mapstructure:"nonce" yaml:"nonce,omitempty"`
Scopes []string `json:"scopes,omitempty" mapstructure:"scopes" yaml:"scopes,omitempty"`
UsePKCE bool `json:"usePKCE,omitempty" mapstructure:"use_pkce" yaml:"use_pkce,omitempty"`
Algorithms []string `json:"algorithms,omitempty" mapstructure:"algorithms" yaml:"algorithms,omitempty"`
}

func (a AuthenticationMethodOIDCProvider) setDefaults(defaults map[string]any) {
defaults["nonce"] = "static"
defaults["algorithms"] = []string{"RS256"}
}

func (a AuthenticationMethodOIDCProvider) validate() error {
Expand Down
11 changes: 9 additions & 2 deletions internal/server/authn/method/oidc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strings"
"time"

"github.com/coreos/go-oidc/v3/oidc"
capoidc "github.com/hashicorp/cap/oidc"
"go.flipt.io/flipt/errors"
"go.flipt.io/flipt/internal/config"
Expand Down Expand Up @@ -206,13 +205,21 @@ func (s *Server) providerFor(provider string, state string) (*capoidc.Provider,
return nil, nil, err
}

algorithms := make([]capoidc.Alg, len(providerCfg.Algorithms))
for i, algorithm := range providerCfg.Algorithms {
algorithms[i] = capoidc.Alg(algorithm)
}
if len(algorithms) == 0 {
algorithms = []capoidc.Alg{capoidc.RS256}
}

callback = callbackURL(providerCfg.RedirectAddress, provider)

config, err = capoidc.NewConfig(
providerCfg.IssuerURL,
providerCfg.ClientID,
capoidc.ClientSecret(providerCfg.ClientSecret),
[]capoidc.Alg{oidc.RS256},
algorithms,
[]string{callback},
)
if err != nil {
Expand Down
Loading