From 6881f1c1c18ac57b794bb58a8603e9a9b0dd363d Mon Sep 17 00:00:00 2001 From: Jordan Labrosse Date: Wed, 28 Jun 2023 13:56:22 +0200 Subject: [PATCH] feat: add skip consent (#124) --- api/v1alpha1/oauth2client_types.go | 4 ++++ config/crd/bases/hydra.ory.sh_oauth2clients.yaml | 5 +++++ hydra/types.go | 2 ++ 3 files changed, 11 insertions(+) diff --git a/api/v1alpha1/oauth2client_types.go b/api/v1alpha1/oauth2client_types.go index 4af09dc..be25a64 100644 --- a/api/v1alpha1/oauth2client_types.go +++ b/api/v1alpha1/oauth2client_types.go @@ -96,6 +96,10 @@ type OAuth2ClientSpec struct { // SecretName points to the K8s secret that contains this client's ID and password SecretName string `json:"secretName"` + // +kubebuilder:validation:type=bool + // +kubebuilder:default=false + SkipConsent bool `json:"skipConsent,omitempty"` + // HydraAdmin is the optional configuration to use for managing // this client HydraAdmin HydraAdmin `json:"hydraAdmin,omitempty"` diff --git a/config/crd/bases/hydra.ory.sh_oauth2clients.yaml b/config/crd/bases/hydra.ory.sh_oauth2clients.yaml index ebc9ebb..670903e 100644 --- a/config/crd/bases/hydra.ory.sh_oauth2clients.yaml +++ b/config/crd/bases/hydra.ory.sh_oauth2clients.yaml @@ -174,6 +174,11 @@ spec: minLength: 1 pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' type: string + skipConsent: + description: + SkipConsent skips the consent screen for this client. + type: boolean + default: false tokenEndpointAuthMethod: allOf: - enum: diff --git a/hydra/types.go b/hydra/types.go index bddd8cd..dbb30b5 100644 --- a/hydra/types.go +++ b/hydra/types.go @@ -25,6 +25,7 @@ type OAuth2ClientJSON struct { ResponseTypes []string `json:"response_types,omitempty"` Audience []string `json:"audience,omitempty"` Scope string `json:"scope"` + SkipConsent bool `json:"skip_consent,omitempty"` Owner string `json:"owner"` TokenEndpointAuthMethod string `json:"token_endpoint_auth_method,omitempty"` Metadata json.RawMessage `json:"metadata,omitempty"` @@ -61,6 +62,7 @@ func FromOAuth2Client(c *hydrav1alpha1.OAuth2Client) (*OAuth2ClientJSON, error) AllowedCorsOrigins: redirectToStringSlice(c.Spec.AllowedCorsOrigins), Audience: c.Spec.Audience, Scope: c.Spec.Scope, + SkipConsent: c.Spec.SkipConsent, Owner: fmt.Sprintf("%s/%s", c.Name, c.Namespace), TokenEndpointAuthMethod: string(c.Spec.TokenEndpointAuthMethod), Metadata: meta,