Skip to content

Commit fc576ed

Browse files
authored
Add missing fields in SelfServiceSso config (#793)
2 parents 4908b4b + abcc5e4 commit fc576ed

File tree

3 files changed

+137
-2
lines changed

3 files changed

+137
-2
lines changed

src/Auth0.ManagementApi/Models/SelfServiceProfiles/EnabledOrganization.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,20 @@ public class EnabledOrganization
1212
/// </summary>
1313
[JsonProperty("organization_id")]
1414
public string OrganizationId { get; set; }
15+
16+
/// <summary>
17+
/// When true, all users that log in with this connection will be automatically granted membership in
18+
/// the organization. When false, users must be granted membership in the organization before logging
19+
/// in with this connection.
20+
/// </summary>
21+
[JsonProperty("assign_membership_on_login")]
22+
public bool? AssignMembershipOnLogin { get; set; }
23+
24+
/// <summary>
25+
/// Determines whether a connection should be displayed on this organization’s login prompt.
26+
/// Only applicable for enterprise connections.
27+
/// </summary>
28+
[JsonProperty("show_as_button")]
29+
public bool? ShowAsButton { get; set; }
1530
}
1631
}

src/Auth0.ManagementApi/Models/SelfServiceProfiles/SelfServiceSsoConnectionConfig.cs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
using System.Runtime.Serialization;
12
using Newtonsoft.Json;
3+
using Newtonsoft.Json.Converters;
24

35
namespace Auth0.ManagementApi.Models.SelfServiceProfiles
46
{
@@ -12,5 +14,105 @@ public class SelfServiceSsoConnectionConfig
1214
/// </summary>
1315
[JsonProperty("name")]
1416
public string Name { get; set; }
17+
18+
/// <summary>
19+
/// Connection name used in the new universal login experience
20+
/// </summary>
21+
[JsonProperty("display_name")]
22+
public string DisplayName { get; set; }
23+
24+
/// <summary>
25+
/// true promotes to a domain-level connection so that third-party applications can use it.
26+
/// false does not promote the connection,
27+
/// so only first-party applications with the connection enabled can use it.
28+
/// </summary>
29+
[JsonProperty("is_domain_connection")]
30+
public bool? IsDomainConnection { get; set; }
31+
32+
/// <summary>
33+
/// Enables showing a button for the connection in the login page (new experience only).
34+
/// If false, it will be usable only by HRD.
35+
/// </summary>
36+
[JsonProperty("show_as_button")]
37+
public bool? ShowAsButton { get; set; }
38+
39+
/// <summary>
40+
/// Metadata associated with the connection in the form of an object with string values (max 255 chars).
41+
/// Maximum of 10 metadata properties allowed.
42+
/// </summary>
43+
[JsonProperty("metadata")]
44+
public dynamic Metadata { get; set; }
45+
46+
/// <inheritdoc cref="SelfServiceSsoConnectionConfigOptions"/>
47+
[JsonProperty("options")]
48+
public SelfServiceSsoConnectionConfigOptions Options { get; set; }
49+
}
50+
51+
/// <summary>
52+
/// The connection's options (depend on the connection strategy)
53+
/// </summary>
54+
public class SelfServiceSsoConnectionConfigOptions {
55+
56+
/// <summary>
57+
/// URL for the icon. Must use HTTPS.
58+
/// </summary>
59+
[JsonProperty("icon_url")]
60+
public string IconUrl { get; set; }
61+
62+
/// <summary>
63+
/// List of domain_aliases that can be authenticated in the Identity Provider
64+
/// </summary>
65+
[JsonProperty("domain_aliases")]
66+
public string[] DomainAliases { get; set; }
67+
68+
/// <inheritdoc cref="SelfServiceSsoConnectionConfigIdpInitiated"/>>
69+
[JsonProperty("idpinitiated")]
70+
public SelfServiceSsoConnectionConfigIdpInitiated IdpInitiated { get; set; }
71+
}
72+
73+
/// <summary>
74+
/// Allows IdP-initiated login
75+
/// </summary>
76+
public class SelfServiceSsoConnectionConfigIdpInitiated
77+
{
78+
/// <summary>
79+
/// Enables IdP-initiated login for this connection
80+
/// </summary>
81+
[JsonProperty("enabled")]
82+
public bool? Enabled { get; set; }
83+
84+
/// <summary>
85+
/// Default application client_id user is redirected to after validated SAML response
86+
/// </summary>
87+
[JsonProperty("client_id")]
88+
public string ClientId { get; set; }
89+
90+
/// <inheritdoc cref="Auth0.ManagementApi.Models.SelfServiceProfiles.ClientProtocol" />
91+
[JsonProperty("client_protocol")]
92+
[JsonConverter(typeof(StringEnumConverter))]
93+
public ClientProtocol ClientProtocol { get; set; }
94+
95+
/// <summary>
96+
/// Query string options to customize the behaviour for OpenID Connect when idpinitiated.client_protocol
97+
/// is oauth2. Allowed parameters: redirect_uri, scope, response_type.
98+
/// For example, redirect_uri=https://jwt.io&scope=openid email&response_type=token
99+
/// </summary>
100+
[JsonProperty("client_authorizequery")]
101+
public string ClientAuthorizeQuery { get; set; }
102+
}
103+
104+
/// <summary>
105+
/// The protocol used to connect to the default application
106+
/// </summary>
107+
public enum ClientProtocol
108+
{
109+
[EnumMember(Value = "samlp")]
110+
Samlp,
111+
112+
[EnumMember(Value = "wsfed")]
113+
Wsfed,
114+
115+
[EnumMember(Value = "oauth2")]
116+
Oauth2
15117
}
16118
}

tests/Auth0.ManagementApi.IntegrationTests/SelfServiceProfileTest.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,31 @@ public async void Test_self_service_sso_ticket_generation_revocation()
7070
{
7171
ConnectionConfig = new SelfServiceSsoConnectionConfig()
7272
{
73-
Name = "Test-Connection-For-SSO"
73+
Name = "Test-Connection-For-SSO",
74+
DisplayName = "Test Display Name",
75+
IsDomainConnection = false,
76+
Metadata = new object(),
77+
ShowAsButton = false,
78+
Options = new SelfServiceSsoConnectionConfigOptions()
79+
{
80+
DomainAliases = new []{"alias1", "alias2"},
81+
IconUrl = "https://cdn2.auth0.com/styleguide/latest/lib/logos/img/favicon.png",
82+
IdpInitiated = new SelfServiceSsoConnectionConfigIdpInitiated()
83+
{
84+
Enabled = true,
85+
ClientId = "AydyL76hVpC0meG2T7lTTQn667mrzS3A",
86+
ClientAuthorizeQuery = "redirect_uri",
87+
ClientProtocol = ClientProtocol.Oauth2
88+
}
89+
}
7490
},
7591
EnabledOrganizations = new List<EnabledOrganization>()
7692
{
7793
new EnabledOrganization()
7894
{
79-
OrganizationId = existingOrganizationId
95+
OrganizationId = existingOrganizationId,
96+
AssignMembershipOnLogin = false,
97+
ShowAsButton = false
8098
}
8199
}
82100
});

0 commit comments

Comments
 (0)