Skip to content

Commit

Permalink
Add validation fields to OIDCProvider
Browse files Browse the repository at this point in the history
Signed-off-by: mark winter <[email protected]>
  • Loading branch information
markwinter committed Mar 8, 2025
1 parent 1ef27f7 commit ba74d8b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
18 changes: 17 additions & 1 deletion api/v1alpha1/oidc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,26 @@ type OIDCProvider struct {
// Issuer MUST be a URI RFC 3986 [RFC3986] with a scheme component that MUST
// be https, a host component, and optionally, port and path components and
// no query or fragment components.
//
// Note: RemoteJWKS field must be set to enable ID token validation
// +kubebuilder:validation:MinLength=1
Issuer string `json:"issuer"`

// TODO zhaohuabing validate the issuer
// Audiences is a list of JWT audiences allowed access. For additional details, see
// https://tools.ietf.org/html/rfc7519#section-4.1.3. If not provided, JWT audiences
// are not checked.
//
// Note: RemoteJWKS field must be set to enable ID token validation
// +kubebuilder:validation:MaxItems=8
// +optional
Audiences []string `json:"audiences,omitempty"`

// RemoteJWKS defines how to fetch and cache JSON Web Key Sets (JWKS) from a remote
// HTTP/HTTPS endpoint.
//
// If set, the ID token will be validated using the RemoteJWKS, Issuer, and Audiences fields
// +optional
RemoteJWKS RemoteJWKS `json:"remoteJWKS"`

// The OIDC Provider's [authorization endpoint](https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint).
// If not provided, EG will try to discover it from the provider's [Well-Known Configuration Endpoint](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse).
Expand Down
6 changes: 6 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2988,7 +2988,9 @@ _Appears in:_
| `backendRef` | _[BackendObjectReference](https://gateway-api.sigs.k8s.io/references/spec/#gateway.networking.k8s.io/v1.BackendObjectReference)_ | false | | BackendRef references a Kubernetes object that represents the<br />backend server to which the authorization request will be sent.<br />Deprecated: Use BackendRefs instead. |
| `backendRefs` | _[BackendRef](#backendref) array_ | false | | BackendRefs references a Kubernetes object that represents the<br />backend server to which the authorization request will be sent. |
| `backendSettings` | _[ClusterSettings](#clustersettings)_ | false | | BackendSettings holds configuration for managing the connection<br />to the backend. |
| `issuer` | _string_ | true | | The OIDC Provider's [issuer identifier](https://openid.net/specs/openid-connect-discovery-1_0.html#IssuerDiscovery).<br />Issuer MUST be a URI RFC 3986 [RFC3986] with a scheme component that MUST<br />be https, a host component, and optionally, port and path components and<br />no query or fragment components. |
| `issuer` | _string_ | true | | The OIDC Provider's [issuer identifier](https://openid.net/specs/openid-connect-discovery-1_0.html#IssuerDiscovery).<br />Issuer MUST be a URI RFC 3986 [RFC3986] with a scheme component that MUST<br />be https, a host component, and optionally, port and path components and<br />no query or fragment components.<br />Note: RemoteJWKS field must be set to enable ID token validation |
| `audiences` | _string array_ | false | | Audiences is a list of JWT audiences allowed access. For additional details, see<br />https://tools.ietf.org/html/rfc7519#section-4.1.3. If not provided, JWT audiences<br />are not checked.<br />Note: RemoteJWKS field must be set to enable ID token validation |
| `remoteJWKS` | _[RemoteJWKS](#remotejwks)_ | false | | RemoteJWKS defines how to fetch and cache JSON Web Key Sets (JWKS) from a remote<br />HTTP/HTTPS endpoint.<br />If set, the ID token will be validated using the RemoteJWKS, Issuer, and Audiences fields |
| `authorizationEndpoint` | _string_ | false | | The OIDC Provider's [authorization endpoint](https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint).<br />If not provided, EG will try to discover it from the provider's [Well-Known Configuration Endpoint](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse). |
| `tokenEndpoint` | _string_ | false | | The OIDC Provider's [token endpoint](https://openid.net/specs/openid-connect-core-1_0.html#TokenEndpoint).<br />If not provided, EG will try to discover it from the provider's [Well-Known Configuration Endpoint](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationResponse). |

Expand Down Expand Up @@ -3831,6 +3833,7 @@ RemoteJWKS defines how to fetch and cache JSON Web Key Sets (JWKS) from a remote

_Appears in:_
- [JWTProvider](#jwtprovider)
- [OIDCProvider](#oidcprovider)

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
Expand Down

0 comments on commit ba74d8b

Please sign in to comment.