Skip to content

Commit

Permalink
fix: add oauth client name to the CRD spec (#56)
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Angelo <[email protected]>
  • Loading branch information
angelokurtis authored Jun 22, 2020
1 parent 99665fa commit e626afc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/v1alpha1/oauth2client_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ type HydraAdmin struct {

// OAuth2ClientSpec defines the desired state of OAuth2Client
type OAuth2ClientSpec struct {

// ClientName is the human-readable string name of the client to be presented to the end-user during authorization.
ClientName string `json:"clientName,omitempty"`

// +kubebuilder:validation:MaxItems=4
// +kubebuilder:validation:MinItems=1
//
Expand Down Expand Up @@ -176,6 +180,7 @@ func init() {
// ToOAuth2ClientJSON converts an OAuth2Client into a OAuth2ClientJSON object that represents an OAuth2 client digestible by ORY Hydra
func (c *OAuth2Client) ToOAuth2ClientJSON() *hydra.OAuth2ClientJSON {
return &hydra.OAuth2ClientJSON{
ClientName: c.Spec.ClientName,
GrantTypes: grantToStringSlice(c.Spec.GrantTypes),
ResponseTypes: responseToStringSlice(c.Spec.ResponseTypes),
RedirectURIs: redirectToStringSlice(c.Spec.RedirectURIs),
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/hydra.ory.sh_oauth2clients.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ spec:
items:
type: string
type: array
clientName:
description: ClientName is the human-readable string name of the client
to be presented to the end-user during authorization.
type: string
grantTypes:
description: GrantTypes is an array of grant types the client is allowed
to use.
Expand Down
1 change: 1 addition & 0 deletions hydra/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

// OAuth2ClientJSON represents an OAuth2 client digestible by ORY Hydra
type OAuth2ClientJSON struct {
ClientName string `json:"client_name,omitempty"`
ClientID *string `json:"client_id,omitempty"`
Secret *string `json:"client_secret,omitempty"`
GrantTypes []string `json:"grant_types"`
Expand Down

0 comments on commit e626afc

Please sign in to comment.