Skip to content

Commit

Permalink
document the client_id and client_secret keys in samples and error me…
Browse files Browse the repository at this point in the history
…ssages (#142)
  • Loading branch information
jdiglesias authored Mar 21, 2024
1 parent 2483bc1 commit 67c8745
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions controllers/oauth2client_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion controllers/oauth2client_controller_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 67c8745

Please sign in to comment.