Skip to content

Commit

Permalink
Add new provider type
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverzheng committed Dec 12, 2023
1 parent 1fe59bc commit bf7a412
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
22 changes: 22 additions & 0 deletions src/WorkOS.net/Services/SSO/Enums/ProviderType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace WorkOS
{
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

/// <summary>
/// Constants that enumerate available OAuth provider types to initiate OAuth authentication.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ProviderType
{
[EnumMember(Value = "GitHubOAuth")]
GitHubOAuth,

[EnumMember(Value = "GoogleOAuth")]
GoogleOAuth,

[EnumMember(Value = "MicrosoftOAuth")]
MicrosoftOAuth,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ public class GetAuthorizationURLOptions : BaseOptions
public string Organization { get; set; }

/// <summary>
/// An optional parameter that specifies the type of Connection to
/// authenticate with. If used, a user of any domain can be
/// authenticated. Only `GoogleOAuth` is currently supported.
/// Used to initiate authentication with OAuth.
/// </summary>
[JsonProperty("provider")]
public ConnectionType? Provider { get; set; }
public ProviderType? Provider { get; set; }

/// <summary>
/// A callback URL where the application redirects the user-agent after
Expand Down
8 changes: 4 additions & 4 deletions test/WorkOSTests/Services/SSO/SSOServiceTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace WorkOSTests
namespace WorkOSTests
{
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -64,7 +64,7 @@ public void TestGetAuthorizationURLWithProvider()
var options = new GetAuthorizationURLOptions
{
ClientId = "client_123",
Provider = ConnectionType.GoogleOAuth,
Provider = ProviderType.GoogleOAuth,
RedirectURI = "https://example.com/sso/callback",
};
string url = this.service.GetAuthorizationURL(options);
Expand Down Expand Up @@ -105,7 +105,7 @@ public void TestGetAuthorizationURLWithDomainHint()
{
ClientId = "client_123",
DomainHint = "foo-corp.com",
Provider = ConnectionType.GoogleOAuth,
Provider = ProviderType.GoogleOAuth,
RedirectURI = "https://example.com/sso/callback",
};
string url = this.service.GetAuthorizationURL(options);
Expand All @@ -124,7 +124,7 @@ public void TestGetAuthorizationURLWithLoginHint()
{
ClientId = "client_123",
LoginHint = "foo@workos.com",
Provider = ConnectionType.GoogleOAuth,
Provider = ProviderType.GoogleOAuth,
RedirectURI = "https://example.com/sso/callback",
};
string url = this.service.GetAuthorizationURL(options);
Expand Down

0 comments on commit bf7a412

Please sign in to comment.