Skip to content

Commit

Permalink
Add pinniped_supported_identity_provider_types to the IDP discovery e…
Browse files Browse the repository at this point in the history
…ndpoint
  • Loading branch information
joshuatcasey committed Apr 30, 2024
1 parent b99da0c commit 82440ad
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021-2022 the Pinniped contributors. All Rights Reserved.
// Copyright 2021-2024 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package v1alpha1
Expand Down Expand Up @@ -54,7 +54,8 @@ type OIDCDiscoveryResponseIDPEndpoint struct {

// IDPDiscoveryResponse is the response of a FederationDomain's identity provider discovery endpoint.
type IDPDiscoveryResponse struct {
PinnipedIDPs []PinnipedIDP `json:"pinniped_identity_providers"`
PinnipedIDPs []PinnipedIDP `json:"pinniped_identity_providers"`
PinnipedSupportedIDPTypes []PinnipedSupportedIDPType `json:"pinniped_supported_identity_provider_types"`
}

// PinnipedIDP describes a single identity provider as included in the response of a FederationDomain's
Expand All @@ -64,3 +65,8 @@ type PinnipedIDP struct {
Type IDPType `json:"type"`
Flows []IDPFlow `json:"flows,omitempty"`
}

// PinnipedSupportedIDPType describes a single identity provider type.
type PinnipedSupportedIDPType struct {
Type IDPType `json:"type"`
}

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

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

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

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

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

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

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,23 @@ func NewHandler(upstreamIDPs federationdomainproviders.FederationDomainIdentityP
}

func responseAsJSON(upstreamIDPs federationdomainproviders.FederationDomainIdentityProvidersListerI) ([]byte, error) {
r := v1alpha1.IDPDiscoveryResponse{PinnipedIDPs: []v1alpha1.PinnipedIDP{}}
r := v1alpha1.IDPDiscoveryResponse{
PinnipedSupportedIDPTypes: []v1alpha1.PinnipedSupportedIDPType{
{Type: v1alpha1.IDPTypeActiveDirectory},
{Type: v1alpha1.IDPTypeLDAP},
{Type: v1alpha1.IDPTypeOIDC},
},
}

upstreams := upstreamIDPs.GetIdentityProviders()
r.PinnipedIDPs = make([]v1alpha1.PinnipedIDP, len(upstreams))
// The cache of IDPs could change at any time, so always recalculate the list.
for _, federationDomainIdentityProvider := range upstreamIDPs.GetIdentityProviders() {
r.PinnipedIDPs = append(r.PinnipedIDPs, v1alpha1.PinnipedIDP{
for i, federationDomainIdentityProvider := range upstreams {
r.PinnipedIDPs[i] = v1alpha1.PinnipedIDP{
Name: federationDomainIdentityProvider.GetDisplayName(),
Type: federationDomainIdentityProvider.GetIDPDiscoveryType(),
Flows: federationDomainIdentityProvider.GetIDPDiscoveryFlows(),
})
}
}

// Nobody like an API that changes the results unnecessarily. :)
Expand Down
Loading

0 comments on commit 82440ad

Please sign in to comment.