From d2f305c304060f9c7e0a7bfc158c0f4e1e9bf0df Mon Sep 17 00:00:00 2001 From: Andre Marianiello Date: Sat, 25 Mar 2023 20:03:36 -0400 Subject: [PATCH] chore: make format --- api/v1alpha1/groupversion_info.go | 2 +- api/v1alpha1/oauth2client_types.go | 2 +- api/v1alpha1/oauth2client_types_test.go | 2 +- api/v1alpha1/zz_generated.deepcopy.go | 3 + .../crd/bases/hydra.ory.sh_oauth2clients.yaml | 378 ++++++++++-------- config/rbac/role.yaml | 65 ++- controllers/mocks/hydra/Client.go | 2 +- controllers/oauth2client_controller.go | 2 +- ...auth2client_controller_integration_test.go | 2 +- controllers/suite_test.go | 2 +- helpers/http_client.go | 2 +- helpers/http_client_test.go | 2 +- hydra/client.go | 2 +- hydra/client_test.go | 2 +- hydra/types.go | 2 +- main.go | 2 +- 16 files changed, 267 insertions(+), 205 deletions(-) diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index f490e6f..ae7131c 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 // Package v1alpha1 contains API Schema definitions for the hydra v1alpha1 API group diff --git a/api/v1alpha1/oauth2client_types.go b/api/v1alpha1/oauth2client_types.go index 90aca68..4af09dc 100644 --- a/api/v1alpha1/oauth2client_types.go +++ b/api/v1alpha1/oauth2client_types.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package v1alpha1 diff --git a/api/v1alpha1/oauth2client_types_test.go b/api/v1alpha1/oauth2client_types_test.go index c92767b..0c33d00 100644 --- a/api/v1alpha1/oauth2client_types_test.go +++ b/api/v1alpha1/oauth2client_types_test.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package v1alpha1 diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 5c87e2f..468216d 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1,3 +1,6 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + //go:build !ignore_autogenerated // +build !ignore_autogenerated diff --git a/config/crd/bases/hydra.ory.sh_oauth2clients.yaml b/config/crd/bases/hydra.ory.sh_oauth2clients.yaml index 9baa883..ebc9ebb 100644 --- a/config/crd/bases/hydra.ory.sh_oauth2clients.yaml +++ b/config/crd/bases/hydra.ory.sh_oauth2clients.yaml @@ -1,4 +1,3 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition @@ -16,175 +15,236 @@ spec: singular: oauth2client scope: Namespaced versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: OAuth2Client is the Schema for the oauth2clients API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: OAuth2ClientSpec defines the desired state of OAuth2Client - properties: - allowedCorsOrigins: - description: AllowedCorsOrigins is an array of allowed CORS origins - items: - description: RedirectURI represents a redirect URI for the client - pattern: \w+:/?/?[^\s]+ - type: string - type: array - audience: - description: Audience is a whitelist defining the audiences this client is allowed to request tokens for - 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. - items: - description: GrantType represents an OAuth 2.0 grant type - enum: - - client_credentials - - authorization_code - - implicit - - refresh_token + - name: v1alpha1 + schema: + openAPIV3Schema: + description: OAuth2Client is the Schema for the oauth2clients API + properties: + apiVersion: + description: + "APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the + latest internal value, and may reject unrecognized values. More + info: + https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources" + type: string + kind: + description: + "Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the + client submits requests to. Cannot be updated. In CamelCase. + More info: + https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" + type: string + metadata: + type: object + spec: + description: + OAuth2ClientSpec defines the desired state of OAuth2Client + properties: + allowedCorsOrigins: + description: + AllowedCorsOrigins is an array of allowed CORS origins + items: + description: + RedirectURI represents a redirect URI for the client + pattern: \w+:/?/?[^\s]+ + type: string + type: array + audience: + description: + Audience is a whitelist defining the audiences this client + is allowed to request tokens for + 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 - maxItems: 4 - minItems: 1 - type: array - hydraAdmin: - description: HydraAdmin is the optional configuration to use for managing this client - properties: - endpoint: - description: Endpoint is the endpoint for the hydra instance on which to set up the client. This value will override the value provided to `--endpoint` (defaults to `"/clients"` in the application) - pattern: (^$|^/.*) + grantTypes: + description: + GrantTypes is an array of grant types the client is allowed + to use. + items: + description: GrantType represents an OAuth 2.0 grant type + enum: + - client_credentials + - authorization_code + - implicit + - refresh_token type: string - forwardedProto: - description: ForwardedProto overrides the `--forwarded-proto` flag. The value "off" will force this to be off even if `--forwarded-proto` is specified - pattern: (^$|https?|off) + maxItems: 4 + minItems: 1 + type: array + hydraAdmin: + description: + HydraAdmin is the optional configuration to use for managing + this client + properties: + endpoint: + description: + Endpoint is the endpoint for the hydra instance on which + to set up the client. This value will override the value + provided to `--endpoint` (defaults to `"/clients"` in + the application) + pattern: (^$|^/.*) + type: string + forwardedProto: + description: + ForwardedProto overrides the `--forwarded-proto` flag. + The value "off" will force this to be off even if + `--forwarded-proto` is specified + pattern: (^$|https?|off) + type: string + port: + description: + Port is the port for the hydra instance on which to set + up the client. This value will override the value + provided to `--hydra-port` + maximum: 65535 + type: integer + url: + description: + URL is the URL for the hydra instance on which to set up + the client. This value will override the value provided + to `--hydra-url` + maxLength: 64 + pattern: (^$|^https?://.*) + type: string + type: object + metadata: + description: Metadata is abritrary data + nullable: true + type: object + x-kubernetes-preserve-unknown-fields: true + postLogoutRedirectUris: + description: + PostLogoutRedirectURIs is an array of the post logout + redirect URIs allowed for the application + items: + description: + RedirectURI represents a redirect URI for the client + pattern: \w+:/?/?[^\s]+ type: string - port: - description: Port is the port for the hydra instance on which to set up the client. This value will override the value provided to `--hydra-port` - maximum: 65535 - type: integer - url: - description: URL is the URL for the hydra instance on which to set up the client. This value will override the value provided to `--hydra-url` - maxLength: 64 - pattern: (^$|^https?://.*) + type: array + redirectUris: + description: + RedirectURIs is an array of the redirect URIs allowed for + the application + items: + description: + RedirectURI represents a redirect URI for the client + pattern: \w+:/?/?[^\s]+ type: string - type: object - metadata: - description: Metadata is abritrary data - nullable: true - type: object - x-kubernetes-preserve-unknown-fields: true - postLogoutRedirectUris: - description: PostLogoutRedirectURIs is an array of the post logout redirect URIs allowed for the application - items: - description: RedirectURI represents a redirect URI for the client - pattern: \w+:/?/?[^\s]+ + type: array + responseTypes: + description: + ResponseTypes is an array of the OAuth 2.0 response type + strings that the client can use at the authorization + endpoint. + items: + description: + ResponseType represents an OAuth 2.0 response type strings + enum: + - id_token + - code + - token + - code token + - code id_token + - id_token token + - code id_token token + type: string + maxItems: 3 + minItems: 1 + type: array + scope: + description: + Scope is a string containing a space-separated list of scope + values (as described in Section 3.3 of OAuth 2.0 [RFC6749]) + that the client can use when requesting access tokens. + pattern: ([a-zA-Z0-9\.\*]+\s?)+ type: string - type: array - redirectUris: - description: RedirectURIs is an array of the redirect URIs allowed for the application - items: - description: RedirectURI represents a redirect URI for the client - pattern: \w+:/?/?[^\s]+ + secretName: + description: + SecretName points to the K8s secret that contains this + client's ID and password + maxLength: 253 + minLength: 1 + pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' type: string - type: array - responseTypes: - description: ResponseTypes is an array of the OAuth 2.0 response type strings that the client can use at the authorization endpoint. - items: - description: ResponseType represents an OAuth 2.0 response type strings - enum: - - id_token - - code - - token - - code token - - code id_token - - id_token token - - code id_token token + tokenEndpointAuthMethod: + allOf: + - enum: + - client_secret_basic + - client_secret_post + - private_key_jwt + - none + - enum: + - client_secret_basic + - client_secret_post + - private_key_jwt + - none + description: + Indication which authentication method shoud be used for the + token endpoint type: string - maxItems: 3 - minItems: 1 - type: array - scope: - description: Scope is a string containing a space-separated list of scope values (as described in Section 3.3 of OAuth 2.0 [RFC6749]) that the client can use when requesting access tokens. - pattern: ([a-zA-Z0-9\.\*]+\s?)+ - type: string - secretName: - description: SecretName points to the K8s secret that contains this client's ID and password - maxLength: 253 - minLength: 1 - pattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*' - type: string - tokenEndpointAuthMethod: - allOf: - - enum: - - client_secret_basic - - client_secret_post - - private_key_jwt - - none - - enum: - - client_secret_basic - - client_secret_post - - private_key_jwt - - none - description: Indication which authentication method shoud be used for the token endpoint - type: string - required: - - grantTypes - - scope - - secretName - type: object - status: - description: OAuth2ClientStatus defines the observed state of OAuth2Client - properties: - conditions: - items: - description: OAuth2ClientCondition contains condition information for an OAuth2Client + required: + - grantTypes + - scope + - secretName + type: object + status: + description: + OAuth2ClientStatus defines the observed state of OAuth2Client + properties: + conditions: + items: + description: + OAuth2ClientCondition contains condition information for + an OAuth2Client + properties: + status: + enum: + - "True" + - "False" + - Unknown + type: string + type: + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + description: + ObservedGeneration represents the most recent generation + observed by the daemon set controller. + format: int64 + type: integer + reconciliationError: + description: + ReconciliationError represents an error that occurred during + the reconciliation process properties: - status: - enum: - - "True" - - "False" - - Unknown + description: + description: + Description is the description of the reconciliation + error type: string - type: + statusCode: + description: + Code is the status code of the reconciliation error type: string - required: - - status - - type type: object - type: array - observedGeneration: - description: ObservedGeneration represents the most recent generation observed by the daemon set controller. - format: int64 - type: integer - reconciliationError: - description: ReconciliationError represents an error that occurred during the reconciliation process - properties: - description: - description: Description is the description of the reconciliation error - type: string - statusCode: - description: Code is the status code of the reconciliation error - type: string - type: object - type: object - type: object - served: true - storage: true - subresources: - status: {} + type: object + type: object + served: true + storage: true + subresources: + status: {} status: acceptedNames: kind: "" diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 70b1e0c..9d43f10 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -1,4 +1,3 @@ - --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole @@ -6,35 +5,35 @@ metadata: creationTimestamp: null name: manager-role rules: -- apiGroups: - - "" - resources: - - secrets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - hydra.ory.sh - resources: - - oauth2clients - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - hydra.ory.sh - resources: - - oauth2clients/status - verbs: - - get - - patch - - update + - apiGroups: + - "" + resources: + - secrets + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - hydra.ory.sh + resources: + - oauth2clients + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - hydra.ory.sh + resources: + - oauth2clients/status + verbs: + - get + - patch + - update diff --git a/controllers/mocks/hydra/Client.go b/controllers/mocks/hydra/Client.go index 3ad4f8c..4793236 100644 --- a/controllers/mocks/hydra/Client.go +++ b/controllers/mocks/hydra/Client.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 // Code generated by mockery v1.0.0. DO NOT EDIT. diff --git a/controllers/oauth2client_controller.go b/controllers/oauth2client_controller.go index abf1438..98ddab5 100644 --- a/controllers/oauth2client_controller.go +++ b/controllers/oauth2client_controller.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package controllers diff --git a/controllers/oauth2client_controller_integration_test.go b/controllers/oauth2client_controller_integration_test.go index 3bacb1d..1b3f266 100644 --- a/controllers/oauth2client_controller_integration_test.go +++ b/controllers/oauth2client_controller_integration_test.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package controllers_test diff --git a/controllers/suite_test.go b/controllers/suite_test.go index aa50f1f..263cfc5 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package controllers_test diff --git a/helpers/http_client.go b/helpers/http_client.go index cc1ac72..2c2729c 100644 --- a/helpers/http_client.go +++ b/helpers/http_client.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package helpers diff --git a/helpers/http_client_test.go b/helpers/http_client_test.go index b4e06bf..50ec939 100644 --- a/helpers/http_client_test.go +++ b/helpers/http_client_test.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package helpers_test diff --git a/hydra/client.go b/hydra/client.go index 8ef684e..68433e8 100644 --- a/hydra/client.go +++ b/hydra/client.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package hydra diff --git a/hydra/client_test.go b/hydra/client_test.go index ae66050..cd58ba0 100644 --- a/hydra/client_test.go +++ b/hydra/client_test.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package hydra_test diff --git a/hydra/types.go b/hydra/types.go index 6813905..bddd8cd 100644 --- a/hydra/types.go +++ b/hydra/types.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package hydra diff --git a/main.go b/main.go index cffd5ac..c388327 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Ory Corp +// Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 package main