feat: add skip consent (#124)

This commit is contained in:
Jordan Labrosse 2023-06-28 13:56:22 +02:00 committed by GitHub
parent 8d57beb5ba
commit 6881f1c1c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -96,6 +96,10 @@ type OAuth2ClientSpec struct {
// SecretName points to the K8s secret that contains this client's ID and password // SecretName points to the K8s secret that contains this client's ID and password
SecretName string `json:"secretName"` 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 // HydraAdmin is the optional configuration to use for managing
// this client // this client
HydraAdmin HydraAdmin `json:"hydraAdmin,omitempty"` HydraAdmin HydraAdmin `json:"hydraAdmin,omitempty"`

View File

@ -174,6 +174,11 @@ spec:
minLength: 1 minLength: 1
pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'
type: string type: string
skipConsent:
description:
SkipConsent skips the consent screen for this client.
type: boolean
default: false
tokenEndpointAuthMethod: tokenEndpointAuthMethod:
allOf: allOf:
- enum: - enum:

View File

@ -25,6 +25,7 @@ type OAuth2ClientJSON struct {
ResponseTypes []string `json:"response_types,omitempty"` ResponseTypes []string `json:"response_types,omitempty"`
Audience []string `json:"audience,omitempty"` Audience []string `json:"audience,omitempty"`
Scope string `json:"scope"` Scope string `json:"scope"`
SkipConsent bool `json:"skip_consent,omitempty"`
Owner string `json:"owner"` Owner string `json:"owner"`
TokenEndpointAuthMethod string `json:"token_endpoint_auth_method,omitempty"` TokenEndpointAuthMethod string `json:"token_endpoint_auth_method,omitempty"`
Metadata json.RawMessage `json:"metadata,omitempty"` Metadata json.RawMessage `json:"metadata,omitempty"`
@ -61,6 +62,7 @@ func FromOAuth2Client(c *hydrav1alpha1.OAuth2Client) (*OAuth2ClientJSON, error)
AllowedCorsOrigins: redirectToStringSlice(c.Spec.AllowedCorsOrigins), AllowedCorsOrigins: redirectToStringSlice(c.Spec.AllowedCorsOrigins),
Audience: c.Spec.Audience, Audience: c.Spec.Audience,
Scope: c.Spec.Scope, Scope: c.Spec.Scope,
SkipConsent: c.Spec.SkipConsent,
Owner: fmt.Sprintf("%s/%s", c.Name, c.Namespace), Owner: fmt.Sprintf("%s/%s", c.Name, c.Namespace),
TokenEndpointAuthMethod: string(c.Spec.TokenEndpointAuthMethod), TokenEndpointAuthMethod: string(c.Spec.TokenEndpointAuthMethod),
Metadata: meta, Metadata: meta,