Skip to content

Commit

Permalink
feat: fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
michael12312 committed Oct 11, 2023
1 parent 3f4bdbe commit b12ba4a
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions pkg/plugins/identity/oidc/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,29 +178,13 @@ func (p *oidcIdentityProvider) getConfigFromUrl(configSet config.ConfigurationSe
}

func readConfigs(p *oidcIdentityProvider, configSet config.ConfigurationSet, configValue string) {
skipSsl := false
if configSet.Get("skip-ssl") != nil {
skip := configSet.Get("skip-ssl").Value
if skip != nil {
if skip.(string) == True {
skipSsl = true
}
}
}
if skipSsl {
if getValue(configSet, "skip-ssl") == True {
SetTransport("")
} else {
readCa := false
if configSet.Get("ca-cert") != nil {
caCert := configSet.Get("ca-cert").Value
if caCert != nil {
if caCert.(string) != "" {
readCa = true
SetTransport(caCert.(string))
}
}
}
if !readCa {
caCert := getValue(configSet, "ca-cert")
if caCert != "" {
SetTransport(caCert)
} else {
p.logger.Errorf("CA cert is required to call the config url.")
return
}
Expand Down Expand Up @@ -256,6 +240,16 @@ func SetTransport(file string) {
http.DefaultTransport.(*http.Transport).TLSClientConfig = config
}

func getValue(configSet config.ConfigurationSet, key string) (value string) {
if configSet.Get(key) != nil {
val := configSet.Get(key).Value
if val != nil {
value = val.(string)
}
}
return
}

// ConfigurationItems will return the configuration items for the identity plugin based
// of the cluster provider that its being used in conjunction with
func ConfigurationItems(scopeTo string) (config.ConfigurationSet, error) {
Expand Down

0 comments on commit b12ba4a

Please sign in to comment.