Skip to content

Commit 3ee1f94

Browse files
committed
support hosted authenticate OIDC mode
1 parent dfec475 commit 3ee1f94

5 files changed

Lines changed: 20 additions & 7 deletions

File tree

apis/ingress/v1/pomerium_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type IdentityProvider struct {
2828
// Provider is the short-hand name of a built-in OpenID Connect (oidc) identity provider to be used for authentication.
2929
// To use a generic provider, set to <code>oidc</code>.
3030
// +kubebuilder:validation:Required
31-
// +kubebuilder:validation:Enum=auth0;azure;github;gitlab;google;oidc;okta;onelogin;ping
31+
// +kubebuilder:validation:Enum=apple;auth0;azure;cognito;github;gitlab;google;hosted;oidc;okta;onelogin;ping
3232
Provider string `json:"provider"`
3333
// URL is the base path to an identity provider's OpenID connect discovery document.
3434
// See <a href="https://pomerium.com/docs/identity-providers">Identity Providers</a> guides for details.
@@ -39,7 +39,7 @@ type IdentityProvider struct {
3939
URL *string `json:"url"`
4040
// Secret containing IdP provider specific parameters.
4141
// and must contain at least <code>client_id</code> and <code>client_secret</code> values.
42-
// +kubebuilder:validation:Required
42+
// +kubebuilder:validation:Optional
4343
// +kubebuilder:validation:Type=string
4444
// +kubebuilder:validation:MinLength=1
4545
// +kubebuilder:validation:Format="namespace/name"

config/crd/bases/ingress.pomerium.io_pomerium.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,14 @@ spec:
301301
Provider is the short-hand name of a built-in OpenID Connect (oidc) identity provider to be used for authentication.
302302
To use a generic provider, set to <code>oidc</code>.
303303
enum:
304+
- apple
304305
- auth0
305306
- azure
307+
- cognito
306308
- github
307309
- gitlab
308310
- google
311+
- hosted
309312
- oidc
310313
- okta
311314
- onelogin
@@ -369,7 +372,6 @@ spec:
369372
type: string
370373
required:
371374
- provider
372-
- secret
373375
type: object
374376
idpAccessTokenAllowedAudiences:
375377
description: |-

controllers/settings/fetch.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
"github.com/pomerium/ingress-controller/model"
1414
"github.com/pomerium/ingress-controller/util"
15+
"github.com/pomerium/pomerium/pkg/identity/oidc/hosted"
1516
)
1617

1718
// FetchConfig returns
@@ -121,11 +122,16 @@ func fetchConfigSecrets(ctx context.Context, client client.Client, cfg *model.Co
121122
if s.IdentityProvider == nil {
122123
return nil
123124
}
124-
return applyAll(
125-
apply("secret", required(&s.IdentityProvider.Secret), &cfg.IdpSecret),
125+
var secrets []func() error
126+
if s.IdentityProvider.Provider != hosted.Name {
127+
secrets = append(secrets,
128+
apply("secret", required(&s.IdentityProvider.Secret), &cfg.IdpSecret))
129+
}
130+
secrets = append(secrets,
126131
apply("request params", optional(s.IdentityProvider.RequestParamsSecret), &cfg.RequestParams),
127132
apply("service account", optional(s.IdentityProvider.ServiceAccountFromSecret), &cfg.IdpServiceAccount),
128133
)
134+
return applyAll(secrets...)
129135
},
130136
// ssh secrets
131137
func() error {

deployment.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,14 @@ spec:
443443
Provider is the short-hand name of a built-in OpenID Connect (oidc) identity provider to be used for authentication.
444444
To use a generic provider, set to <code>oidc</code>.
445445
enum:
446+
- apple
446447
- auth0
447448
- azure
449+
- cognito
448450
- github
449451
- gitlab
450452
- google
453+
- hosted
451454
- oidc
452455
- okta
453456
- onelogin
@@ -511,7 +514,6 @@ spec:
511514
type: string
512515
required:
513516
- provider
514-
- secret
515517
type: object
516518
idpAccessTokenAllowedAudiences:
517519
description: |-

pomerium/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/pomerium/ingress-controller/util"
1818
"github.com/pomerium/pomerium/config"
1919
pb "github.com/pomerium/pomerium/pkg/grpc/config"
20+
"github.com/pomerium/pomerium/pkg/identity/oidc/hosted"
2021
)
2122

2223
type applyOpt struct {
@@ -53,9 +54,11 @@ func ApplyConfig(ctx context.Context, dst *pb.Config, src *model.Config) error {
5354
opts = append(opts, []applyOpt{
5455
{"idp", applyIDP},
5556
{"idp url", applyIDPProviderURL},
56-
{"idp secret", applyIDPSecret},
5757
{"idp request params", applyIDPRequestParams},
5858
}...)
59+
if src.Spec.IdentityProvider.Provider != hosted.Name {
60+
opts = append(opts, applyOpt{"idp secret", applyIDPSecret})
61+
}
5962
}
6063

6164
for _, apply := range opts {

0 commit comments

Comments
 (0)