Skip to content

Commit

Permalink
[installer]: validate the AuthProvider config value
Browse files Browse the repository at this point in the history
Adds the id, host and type params to the AuthProvider and also adds validation
on the required fields
  • Loading branch information
Simon Emms committed Nov 17, 2021
1 parent 6e565c3 commit 5038c84
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions installer/pkg/config/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type Config struct {

Workspace Workspace `json:"workspace" validate:"required"`

AuthProviders []AuthProviderConfigs `json:"authProviders"`
AuthProviders []AuthProviderConfigs `json:"authProviders" validate:"dive"`
BlockNewUsers BlockNewUsers `json:"blockNewUsers"`
}

Expand Down Expand Up @@ -224,9 +224,12 @@ const (

// todo(sje): I don't know if we want to put this in the config YAML
type AuthProviderConfigs struct {
ID string `json:"id" validate:"required"`
Host string `json:"host" validate:"required"`
Type string `json:"type" validate:"required"`
BuiltIn string `json:"builtin"`
Verified string `json:"verified"`
OAuth OAuth `json:"oauth"`
OAuth OAuth `json:"oauth" validate:"required"`
Params map[string]string `json:"params"`
HiddenOnDashboard bool `json:"hiddenOnDashboard"`
LoginContextMatcher string `json:"loginContextMatcher"`
Expand All @@ -242,9 +245,9 @@ type BlockNewUsers struct {
}

type OAuth struct {
ClientId string `json:"clientId"`
ClientSecret string `json:"clientSecret"`
CallBackUrl string `json:"callBackUrl"`
ClientId string `json:"clientId" validate:"required"`
ClientSecret string `json:"clientSecret" validate:"required"`
CallBackUrl string `json:"callBackUrl" validate:"required"`
AuthorizationUrl string `json:"authorizationUrl"`
TokenUrl string `json:"tokenUrl"`
Scope string `json:"scope"`
Expand Down

0 comments on commit 5038c84

Please sign in to comment.