Skip to content

Commit

Permalink
fix prefix of some global variables
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalSkolasinski committed Aug 21, 2023
1 parent e59c380 commit b89decd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions components/tls/pkg/oauth/k8s_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,37 +71,37 @@ func (s *OAUTHSecretHandler) Stop() {

func (s *OAUTHSecretHandler) saveOAUTHFromSecret(secret *corev1.Secret) error {
// Read and Save oauthbearer method
method, ok := secret.Data[methodKey]
method, ok := secret.Data[SecretKeyMethod]
if !ok {
return fmt.Errorf("Failed to find %s in secret %s", methodKey, secret.Name)
return fmt.Errorf("Failed to find %s in secret %s", SecretKeyMethod, secret.Name)
}
s.oauthConfig.Method = string(method)

// Read and Save oauthbearer client id
clientID, ok := secret.Data[clientIDKey]
clientID, ok := secret.Data[SecretKeyClientID]
if !ok {
return fmt.Errorf("Failed to find %s in secret %s", clientIDKey, secret.Name)
return fmt.Errorf("Failed to find %s in secret %s", SecretKeyClientID, secret.Name)
}
s.oauthConfig.ClientID = string(clientID)

// Read and Save oauthbearer client secret
clientSecret, ok := secret.Data[clientSecretKey]
clientSecret, ok := secret.Data[SecretKeyClientSecret]
if !ok {
return fmt.Errorf("Failed to find %s in secret %s", clientSecretKey, secret.Name)
return fmt.Errorf("Failed to find %s in secret %s", SecretKeyClientSecret, secret.Name)
}
s.oauthConfig.ClientSecret = string(clientSecret)

// Read and Save oauthbearer token endpoint url
tokenEndpointURL, ok := secret.Data[tokenEndpointURLKey]
tokenEndpointURL, ok := secret.Data[SecretKeyTokenEndpointURL]
if !ok {
return fmt.Errorf("Failed to find %s in secret %s", tokenEndpointURLKey, secret.Name)
return fmt.Errorf("Failed to find %s in secret %s", SecretKeyTokenEndpointURL, secret.Name)
}
s.oauthConfig.TokenEndpointURL = string(tokenEndpointURL)

// Read and Save oauthbearer extensions
extensions, ok := secret.Data[extensionsKey]
extensions, ok := secret.Data[SecretKeyExtensions]
if !ok {
return fmt.Errorf("Failed to find %s in secret %s", extensionsKey, secret.Name)
return fmt.Errorf("Failed to find %s in secret %s", SecretKeyExtensions, secret.Name)
}
s.oauthConfig.Extensions = string(extensions)

Expand Down
10 changes: 5 additions & 5 deletions components/tls/pkg/oauth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ limitations under the License.
package oauth

const (
methodKey = "method"
clientIDKey = "client_id"
clientSecretKey = "client_secret"
tokenEndpointURLKey = "token_endpoint_url"
extensionsKey = "extensions"
SecretKeyMethod = "method"
SecretKeyClientID = "client_id"
SecretKeyClientSecret = "client_secret"
SecretKeyTokenEndpointURL = "token_endpoint_url"
SecretKeyExtensions = "extensions"
)

type OAUTHConfig struct {
Expand Down

0 comments on commit b89decd

Please sign in to comment.