Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Ping Federate connection #175

Merged
merged 6 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions management/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ const (
ConnectionStrategyVimeo = "vimeo"
// ConnectionStrategyCustom constant.
ConnectionStrategyCustom = "custom"
// ConnectionStrategyPingFederate constant.
ConnectionStrategyPingFederate = "pingfederate"
)

// Connection is the relationship between Auth0 and a source of users.
Expand Down Expand Up @@ -234,6 +236,8 @@ func (c *Connection) UnmarshalJSON(b []byte) error {
v = &ConnectionOptionsAzureAD{}
case ConnectionStrategyADFS:
v = &ConnectionOptionsADFS{}
case ConnectionStrategyPingFederate:
v = &ConnectionOptionsPingFederate{}
case ConnectionStrategySAML:
v = &ConnectionOptionsSAML{}
case ConnectionStrategyGoogleApps:
Expand Down Expand Up @@ -943,6 +947,30 @@ type ConnectionOptionsADFS struct {
SetUserAttributes *string `json:"set_user_root_attributes,omitempty"`
}

// ConnectionOptionsPingFederate is used to configure a Ping Federate Connection.
type ConnectionOptionsPingFederate struct {
// SigningCert should be used when creating or updating the public key for the Ping Federate server, it will not be
// present when reading a connection and instead you should use the Cert field to check the value.
SigningCert *string `json:"signingCert,omitempty"`

// Cert should only be used when reading the connection. It should not be set on creation or update of a connection, instead
// SigningCert should be used to update the public key for the Ping Federate server.
Cert *string `json:"cert,omitempty"`

LogoURL *string `json:"icon_url,omitempty"`
IdpInitiated *ConnectionOptionsSAMLIdpInitiated `json:"idpinitiated,omitempty"`
TenantDomain *string `json:"tenant_domain,omitempty"`
DomainAliases *[]string `json:"domain_aliases,omitempty"`
SignInEndpoint *string `json:"signInEndpoint,omitempty"`
DigestAlgorithm *string `json:"digestAlgorithm,omitempty"`
SignSAMLRequest *bool `json:"signSAMLRequest,omitempty"`
SignatureAlgorithm *string `json:"signatureAlgorithm,omitempty"`
PingFederateBaseUrl *string `json:"pingFederateBaseUrl,omitempty"`
NonPersistentAttrs *[]string `json:"non_persistent_attrs,omitempty"`
UpstreamParams map[string]interface{} `json:"upstream_params,omitempty"`
SetUserAttributes *string `json:"set_user_root_attributes,omitempty"`
}

// ConnectionOptionsSAML is used to configure a SAML Connection.
type ConnectionOptionsSAML struct {
Cert *string `json:"cert,omitempty"`
Expand Down
41 changes: 39 additions & 2 deletions management/connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,42 @@ ZsUkLw2I7zI/dNlWdB8Xp7v+3w9sX5N3J/WuJ1KOO5m26kRlHQo7EzT3974g
},
},
},
{
name: "Ping Federate Connection",
connection: Connection{
Name: auth0.Stringf("Test-Ping-Federate-Connection-%d", time.Now().Unix()),
Strategy: auth0.String("pingfederate"),
},
options: &ConnectionOptionsPingFederate{
PingFederateBaseUrl: auth0.String("https://ping.example.com"),
SigningCert: auth0.String(`-----BEGIN CERTIFICATE-----
MIID6TCCA1ICAQEwDQYJKoZIhvcNAQEFBQAwgYsxCzAJBgNVBAYTAlVTMRMwEQYD
VQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRQwEgYDVQQK
EwtHb29nbGUgSW5jLjEMMAoGA1UECxMDRW5nMQwwCgYDVQQDEwNhZ2wxHTAbBgkq
hkiG9w0BCQEWDmFnbEBnb29nbGUuY29tMB4XDTA5MDkwOTIyMDU0M1oXDTEwMDkw
OTIyMDU0M1owajELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAf
BgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEjMCEGA1UEAxMaZXVyb3Bh
LnNmby5jb3JwLmdvb2dsZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIK
AoICAQC6pgYt7/EibBDumASF+S0qvqdL/f+nouJw2T1Qc8GmXF/iiUcrsgzh/Fd8
pDhz/T96Qg9IyR4ztuc2MXrmPra+zAuSf5bevFReSqvpIt8Duv0HbDbcqs/XKPfB
uMDe+of7a9GCywvAZ4ZUJcp0thqD9fKTTjUWOBzHY1uNE4RitrhmJCrbBGXbJ249
bvgmb7jgdInH2PU7PT55hujvOoIsQW2osXBFRur4pF1wmVh4W4lTLD6pjfIMUcML
ICHEXEN73PDic8KS3EtNYCwoIld+tpIBjE1QOb1KOyuJBNW6Esw9ALZn7stWdYcE
qAwvv20egN2tEXqj7Q4/1ccyPZc3PQgC3FJ8Be2mtllM+80qf4dAaQ/fWvCtOrQ5
pnfe9juQvCo8Y0VGlFcrSys/MzSg9LJ/24jZVgzQved/Qupsp89wVidwIzjt+WdS
fyWfH0/v1aQLvu5cMYuW//C0W2nlYziL5blETntM8My2ybNARy3ICHxCBv2RNtPI
WQVm+E9/W5rwh2IJR4DHn2LHwUVmT/hHNTdBLl5Uhwr4Wc7JhE7AVqb14pVNz1lr
5jxsp//ncIwftb7mZQ3DF03Yna+jJhpzx8CQoeLT6aQCHyzmH68MrHHT4MALPyUs
Pomjn71GNTtDeWAXibjCgdL6iHACCF6Htbl0zGlG0OAK+bdn0QIDAQABMA0GCSqG
SIb3DQEBBQUAA4GBAOKnQDtqBV24vVqvesL5dnmyFpFPXBn3WdFfwD6DzEb21UVG
5krmJiu+ViipORJPGMkgoL6BjU21XI95VQbun5P8vvg8Z+FnFsvRFY3e1CCzAVQY
ZsUkLw2I7zI/dNlWdB8Xp7v+3w9sX5N3J/WuJ1KOO5m26kRlHQo7EzT3974g
-----END CERTIFICATE-----`),
SignSAMLRequest: auth0.Bool(true),
SignatureAlgorithm: auth0.String("rsa-sha256"),
DigestAlgorithm: auth0.String("sha256"),
},
},
}

type connectionTestCase struct {
Expand Down Expand Up @@ -475,8 +511,9 @@ func TestConnectionManager_Update(t *testing.T) {
if testCase.connection.GetStrategy() == "oidc" ||
testCase.connection.GetStrategy() == "samlp" ||
testCase.connection.GetStrategy() == "okta" ||
testCase.connection.GetStrategy() == "adfs" {
t.Skip("Skipping because we can't create an oidc, okta, samlp or adfs connection with no options")
testCase.connection.GetStrategy() == "adfs" ||
testCase.connection.GetStrategy() == "pingfederate" {
t.Skip("Skipping because we can't create an oidc, okta, samlp, adfs, or pingfederate connection with no options")
}

configureHTTPTestRecordings(t)
Expand Down
109 changes: 109 additions & 0 deletions management/management.gen.go

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

135 changes: 135 additions & 0 deletions management/management.gen_test.go

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

Loading