From 281172edf55fe6800959238fc128964ead6d9101 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Tue, 27 Sep 2022 14:07:28 -0700 Subject: [PATCH] Remove default config (#478) Signed-off-by: Yee Hing Tong --- LICENSE | 2 +- auth/config/config.go | 2 +- auth/config/config_test.go | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index bed437514..9c953bff3 100644 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2019 Lyft, Inc. + Copyright 2022 flyte.org Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/auth/config/config.go b/auth/config/config.go index 00bb79aaf..eca659fe1 100644 --- a/auth/config/config.go +++ b/auth/config/config.go @@ -113,7 +113,7 @@ var ( }, "flytepropeller": { ID: "flytepropeller", - Secret: []byte(`$2a$06$pxs1AkG81Kvrhpml1QiLSOQaTk9eePrU/7Yab9y07h3x0TglbaoT6`), // = "foobar" + Secret: []byte(`$2a$06$d6PQn2QAFU3cL5V8MDkeuuk63xubqUxNxjtfPw.Fc9MgV6vpmyOIy`), // Change this. RedirectURIs: []string{"http://localhost:3846/callback"}, ResponseTypes: []string{"token"}, GrantTypes: []string{"refresh_token", "client_credentials"}, diff --git a/auth/config/config_test.go b/auth/config/config_test.go index ae0a05988..b971371e7 100644 --- a/auth/config/config_test.go +++ b/auth/config/config_test.go @@ -12,7 +12,6 @@ import ( "github.com/flyteorg/flytestdlib/config/viper" "github.com/ghodss/yaml" - "github.com/stretchr/testify/assert" "github.com/ory/fosite" @@ -49,3 +48,14 @@ func TestParseClientSecretConfig(t *testing.T) { assert.NoError(t, accessor.UpdateConfig(context.Background())) assert.Equal(t, "my-client", GetConfig().AppAuth.SelfAuthServer.StaticClients["my-client"].ID) } + +func TestDefaultConfig(t *testing.T) { + assert.Equal(t, len(DefaultConfig.AppAuth.SelfAuthServer.StaticClients), 3) + assert.Equal(t, DefaultConfig.AppAuth.SelfAuthServer.StaticClients["flyte-cli"].ID, "flyte-cli") +} + +func TestCompare(t *testing.T) { + hasher := &fosite.BCrypt{WorkFactor: 6} + err := hasher.Compare(context.Background(), DefaultConfig.AppAuth.SelfAuthServer.StaticClients["flytepropeller"].Secret, []byte("foobar")) + assert.Error(t, err) +}