From 67c8745e11bd5fb117fab1e68410cdb11d1993b3 Mon Sep 17 00:00:00 2001 From: Juan Iglesias Date: Thu, 21 Mar 2024 03:03:01 -0500 Subject: [PATCH] document the client_id and client_secret keys in samples and error messages (#142) --- .../samples/hydra_v1alpha1_oauth2client_custom_namespace.yaml | 4 ++-- .../samples/hydra_v1alpha1_oauth2client_user_credentials.yaml | 4 ++-- controllers/oauth2client_controller.go | 4 ++-- controllers/oauth2client_controller_integration_test.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/samples/hydra_v1alpha1_oauth2client_custom_namespace.yaml b/config/samples/hydra_v1alpha1_oauth2client_custom_namespace.yaml index 8a8bbea..bbb124b 100644 --- a/config/samples/hydra_v1alpha1_oauth2client_custom_namespace.yaml +++ b/config/samples/hydra_v1alpha1_oauth2client_custom_namespace.yaml @@ -11,8 +11,8 @@ metadata: namespace: custom-namespace type: Opaque data: - client_id: NDI0MjQyNDI= - client_secret: czNjUjM3cDRzc1ZWMHJENDMyMQ== + CLIENT_ID: NDI0MjQyNDI= + CLIENT_SECRET: czNjUjM3cDRzc1ZWMHJENDMyMQ== --- apiVersion: hydra.ory.sh/v1alpha1 kind: OAuth2Client diff --git a/config/samples/hydra_v1alpha1_oauth2client_user_credentials.yaml b/config/samples/hydra_v1alpha1_oauth2client_user_credentials.yaml index ca06e57..a06b7a8 100644 --- a/config/samples/hydra_v1alpha1_oauth2client_user_credentials.yaml +++ b/config/samples/hydra_v1alpha1_oauth2client_user_credentials.yaml @@ -5,8 +5,8 @@ metadata: namespace: default type: Opaque data: - client_id: MDA5MDA5MDA= - client_secret: czNjUjM3cDRzc1ZWMHJEMTIzNA== + CLIENT_ID: MDA5MDA5MDA= + CLIENT_SECRET: czNjUjM3cDRzc1ZWMHJEMTIzNA== --- apiVersion: hydra.ory.sh/v1alpha1 kind: OAuth2Client diff --git a/controllers/oauth2client_controller.go b/controllers/oauth2client_controller.go index 8ef02dd..e35d64f 100644 --- a/controllers/oauth2client_controller.go +++ b/controllers/oauth2client_controller.go @@ -404,12 +404,12 @@ func (r *OAuth2ClientReconciler) ensureEmptyStatusError(ctx context.Context, c * func parseSecret(secret apiv1.Secret, authMethod hydrav1alpha1.TokenEndpointAuthMethod) (*hydra.Oauth2ClientCredentials, error) { id, found := secret.Data[ClientIDKey] if !found { - return nil, fmt.Errorf("client_id property missing") + return nil, fmt.Errorf("%s property missing", ClientIDKey) } psw, found := secret.Data[ClientSecretKey] if !found && authMethod != "none" { - return nil, fmt.Errorf("client_secret property missing") + return nil, fmt.Errorf("%s property missing", ClientSecretKey) } return &hydra.Oauth2ClientCredentials{ diff --git a/controllers/oauth2client_controller_integration_test.go b/controllers/oauth2client_controller_integration_test.go index 2d3d9f6..2c53c95 100644 --- a/controllers/oauth2client_controller_integration_test.go +++ b/controllers/oauth2client_controller_integration_test.go @@ -344,7 +344,7 @@ var _ = Describe("OAuth2Client Controller", func() { Expect(err).NotTo(HaveOccurred()) Expect(retrieved.Status.ReconciliationError).NotTo(BeNil()) Expect(retrieved.Status.ReconciliationError.Code).To(Equal(hydrav1alpha1.StatusInvalidSecret)) - Expect(retrieved.Status.ReconciliationError.Description).To(Equal("client_secret property missing")) + Expect(retrieved.Status.ReconciliationError.Description).To(Equal("CLIENT_SECRET property missing")) //delete instance c.Delete(context.TODO(), instance)