Skip to content

Commit

Permalink
fix: renaming the client secret name
Browse files Browse the repository at this point in the history
  • Loading branch information
davenewza committed Nov 28, 2023
1 parent ce924f4 commit bb37c93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
DefaultRefreshTokenExpiry time.Duration = time.Hour * 24 * 90
)

const ProviderSecretPrefix = "KEEL_AUTH_PROVIDER_SECRET_"
const ProviderSecretPrefix = "AUTH_PROVIDER_SECRET_"

const (
GoogleProvider = "google"
Expand Down
20 changes: 10 additions & 10 deletions runtime/apis/authapi/authorize_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestSsoLogin_Success(t *testing.T) {

// Set secret for client
ctx = runtimectx.WithSecrets(ctx, map[string]string{
fmt.Sprintf("KEEL_AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
fmt.Sprintf("AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
})

httpHandler := func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -143,7 +143,7 @@ func TestSsoLogin_WrongSecret(t *testing.T) {

// Set secret for client
ctx = runtimectx.WithSecrets(ctx, map[string]string{
fmt.Sprintf("KEEL_AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "wrong-secret",
fmt.Sprintf("AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "wrong-secret",
})

httpHandler := func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -211,7 +211,7 @@ func TestSsoLogin_InvalidLoginUrl(t *testing.T) {

// Set secret for client
ctx = runtimectx.WithSecrets(ctx, map[string]string{
fmt.Sprintf("KEEL_AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
fmt.Sprintf("AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
})

httpHandler := func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -396,7 +396,7 @@ func TestSsoLogin_ClientIdNotRegistered(t *testing.T) {

// Set secret for client
ctx = runtimectx.WithSecrets(ctx, map[string]string{
fmt.Sprintf("KEEL_AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
fmt.Sprintf("AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
})

httpHandler := func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -458,7 +458,7 @@ func TestSsoLogin_RedirectUrlMismatch(t *testing.T) {

// Set secret for client
ctx = runtimectx.WithSecrets(ctx, map[string]string{
fmt.Sprintf("KEEL_AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
fmt.Sprintf("AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
})

httpHandler := func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -531,7 +531,7 @@ func TestSsoLogin_NoRedirectUrlInConfig(t *testing.T) {

// Set secret for client
ctx = runtimectx.WithSecrets(ctx, map[string]string{
fmt.Sprintf("KEEL_AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
fmt.Sprintf("AUTH_PROVIDER_SECRET_%s", strings.ToUpper("myoidc")): "secret",
})

httpHandler := func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -583,7 +583,7 @@ func TestGetClientSecret(t *testing.T) {

ctx := context.Background()
ctx = runtimectx.WithSecrets(ctx, map[string]string{
"KEEL_AUTH_PROVIDER_SECRET_GOOGLE": "secret",
"AUTH_PROVIDER_SECRET_GOOGLE": "secret",
})

secret, hasSecret := authapi.GetClientSecret(ctx, provider)
Expand All @@ -598,7 +598,7 @@ func TestGetClientSecret_WithUnderscore(t *testing.T) {

ctx := context.Background()
ctx = runtimectx.WithSecrets(ctx, map[string]string{
"KEEL_AUTH_PROVIDER_SECRET_GOOGLE_CLIENT": "secret",
"AUTH_PROVIDER_SECRET_GOOGLE_CLIENT": "secret",
})

secret, hasSecret := authapi.GetClientSecret(ctx, provider)
Expand All @@ -613,7 +613,7 @@ func TestGetClientSecret_WithCapitals(t *testing.T) {

ctx := context.Background()
ctx = runtimectx.WithSecrets(ctx, map[string]string{
"KEEL_AUTH_PROVIDER_SECRET_GOOGLE_CLIENT": "secret",
"AUTH_PROVIDER_SECRET_GOOGLE_CLIENT": "secret",
})

secret, hasSecret := authapi.GetClientSecret(ctx, provider)
Expand All @@ -628,7 +628,7 @@ func TestGetClientSecret_WithNumbers(t *testing.T) {

ctx := context.Background()
ctx = runtimectx.WithSecrets(ctx, map[string]string{
"KEEL_AUTH_PROVIDER_SECRET_CLIENT_2": "secret",
"AUTH_PROVIDER_SECRET_CLIENT_2": "secret",
})

secret, hasSecret := authapi.GetClientSecret(ctx, provider)
Expand Down

0 comments on commit bb37c93

Please sign in to comment.