Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
0bb9d43
Implemented support for User Management API requests. Includes all ge…
richclement Dec 7, 2025
aa3b7b6
Implemented Password Reset API endpoints in the UserManagementService…
richclement Dec 8, 2025
3ddbe5a
Implemented the Organization Membership API endpoints for User Manage…
richclement Dec 8, 2025
d58b58b
Implement Get Logout URL for User Management and appropriate unit tests.
richclement Dec 8, 2025
48a7f6e
Implement the get JWKS url method in the UserManagementService with a…
richclement Dec 8, 2025
8f7acc6
Implement Authenticate with Code to UserManagement, additional classe…
richclement Dec 8, 2025
477eae9
Implemented Authenticate with Refresh Token in UserManagement and uni…
richclement Dec 8, 2025
99a55a5
Merge branch 'main' into implement-user-management
gjtorikian Mar 5, 2026
c023c96
fix: Auto-inject client_secret from API key in auth methods
gjtorikian Mar 5, 2026
0b2ad88
fix: Make PasswordHashType nullable to prevent unintended serialization
gjtorikian Mar 5, 2026
51fc679
fix: Exclude Id from JSON body in update options classes
gjtorikian Mar 5, 2026
d28c9c2
fix: Make GrantType read-only on auth options classes
gjtorikian Mar 5, 2026
332c484
fix: Use long for OAuthTokens.ExpiresAt to avoid Y2038 overflow
gjtorikian Mar 5, 2026
815797e
fix: Use async Task instead of async void in test methods
gjtorikian Mar 5, 2026
5a47684
Merge branch 'main' into implement-user-management
gjtorikian Mar 5, 2026
ec93048
fix: Add null guards, URL encoding, nullable enum, and test coverage
gjtorikian Mar 5, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace WorkOS
{
using Newtonsoft.Json;

/// <summary>
/// Contains the response data from authenticating a user.
/// </summary>
public class AuthenticationResponse
{
/// <summary>
/// The authenticated <see cref="User"/>.
/// </summary>
[JsonProperty("user")]
public User User { get; set; }

/// <summary>
/// The organization ID associated with the user (optional).
/// </summary>
[JsonProperty("organization_id")]
public string OrganizationId { get; set; }

/// <summary>
/// The access token for the authenticated session.
/// </summary>
[JsonProperty("access_token")]
public string AccessToken { get; set; }

/// <summary>
/// The refresh token for refreshing the access token.
/// </summary>
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }

/// <summary>
/// The authentication method used.
/// </summary>
[JsonProperty("authentication_method")]
public AuthenticationMethod? AuthenticationMethod { get; set; }

/// <summary>
/// Information about the impersonator if the user was impersonated (optional).
/// </summary>
[JsonProperty("impersonator")]
public Impersonator Impersonator { get; set; }

/// <summary>
/// OAuth tokens returned by the authentication provider (optional).
/// </summary>
[JsonProperty("oauth_tokens")]
public OAuthTokens OAuthTokens { get; set; }
}
}
22 changes: 22 additions & 0 deletions src/WorkOS.net/Services/UserManagement/Entities/Impersonator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace WorkOS
{
using Newtonsoft.Json;

/// <summary>
/// Contains information about a user who is impersonating another user.
/// </summary>
public class Impersonator
{
/// <summary>
/// The email address of the impersonator.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }

/// <summary>
/// The reason for impersonation.
/// </summary>
[JsonProperty("reason")]
public string Reason { get; set; }
}
}
35 changes: 35 additions & 0 deletions src/WorkOS.net/Services/UserManagement/Entities/OAuthTokens.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace WorkOS
{
using System.Collections.Generic;
using Newtonsoft.Json;

/// <summary>
/// Contains OAuth tokens returned by an external OAuth provider.
/// </summary>
public class OAuthTokens
{
/// <summary>
/// The access token from the OAuth provider.
/// </summary>
[JsonProperty("access_token")]
public string AccessToken { get; set; }

/// <summary>
/// The refresh token from the OAuth provider.
/// </summary>
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }

/// <summary>
/// The timestamp at which the access token expires.
/// </summary>
[JsonProperty("expires_at")]
public long ExpiresAt { get; set; }

/// <summary>
/// The list of OAuth scopes for which the access token is authorized.
/// </summary>
[JsonProperty("scopes")]
public List<string> Scopes { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
namespace WorkOS
{
using System.Collections.Generic;
using Newtonsoft.Json;

/// <summary>
/// Contains information about a WorkOS Organization Membership record.
/// </summary>
public class OrganizationMembership
{
/// <summary>
/// Description of the record.
/// </summary>
[JsonProperty("object")]
public const string Object = "organization_membership";

/// <summary>
/// The organization membership's identifier.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// The user's identifier.
/// </summary>
[JsonProperty("user_id")]
public string UserId { get; set; }

/// <summary>
/// The organization's identifier.
/// </summary>
[JsonProperty("organization_id")]
public string OrganizationId { get; set; }

/// <summary>
/// The organization's name.
/// </summary>
[JsonProperty("organization_name")]
public string OrganizationName { get; set; }

/// <summary>
/// The primary role assigned to the membership.
/// </summary>
[JsonProperty("role")]
public OrganizationMembershipRole Role { get; set; }

/// <summary>
/// List of roles assigned to the membership.
/// </summary>
[JsonProperty("roles")]
public List<OrganizationMembershipRole> Roles { get; set; }

/// <summary>
/// The status of the organization membership.
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }

/// <summary>
/// The timestamp of when the organization membership was created.
/// </summary>
[JsonProperty("created_at")]
public string CreatedAt { get; set; }

/// <summary>
/// The timestamp of when the organization membership was updated.
/// </summary>
[JsonProperty("updated_at")]
public string UpdatedAt { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace WorkOS
{
using Newtonsoft.Json;

/// <summary>
/// Contains information about a role in an organization membership.
/// </summary>
public class OrganizationMembershipRole
{
/// <summary>
/// The slug identifier of the role.
/// </summary>
[JsonProperty("slug")]
public string Slug { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace WorkOS
{
using System;
using Newtonsoft.Json;

/// <summary>
/// Contains information about a WorkOS Password Reset record.
/// </summary>
public class PasswordReset
{
/// <summary>
/// The Password Reset identifier.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// The User identifier associated with this password reset.
/// </summary>
[JsonProperty("user_id")]
public string UserId { get; set; }

/// <summary>
/// The email address associated with this password reset.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }

/// <summary>
/// The password reset token that can be used to reset the user's password.
/// </summary>
[JsonProperty("password_reset_token")]
public string PasswordResetToken { get; set; }

/// <summary>
/// The URL where the user can reset their password using the token.
/// </summary>
[JsonProperty("password_reset_url")]
public string PasswordResetUrl { get; set; }

/// <summary>
/// The timestamp when this password reset token expires.
/// </summary>
[JsonProperty("expires_at")]
public string ExpiresAt { get; set; }

/// <summary>
/// The timestamp of when the password reset was created.
/// </summary>
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
}
}
90 changes: 90 additions & 0 deletions src/WorkOS.net/Services/UserManagement/Entities/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
namespace WorkOS
{
using System;
using System.Collections.Generic;
using Newtonsoft.Json;

/// <summary>
/// Contains information about a WorkOS User record.
/// </summary>
public class User
{
/// <summary>
/// Description of the record.
/// </summary>
[JsonProperty("object")]
public const string Object = "user";

/// <summary>
/// The User's identifier.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// The User's email address.
/// </summary>
[JsonProperty("email")]
public string Email { get; set; }

/// <summary>
/// The User's first name.
/// </summary>
[JsonProperty("first_name")]
public string FirstName { get; set; }

/// <summary>
/// The User's last name.
/// </summary>
[JsonProperty("last_name")]
public string LastName { get; set; }

/// <summary>
/// Whether the User's email address has been verified.
/// </summary>
[JsonProperty("email_verified")]
public bool EmailVerified { get; set; }

/// <summary>
/// The User's profile picture URL.
/// </summary>
[JsonProperty("profile_picture_url")]
public string ProfilePictureUrl { get; set; }

/// <summary>
/// The timestamp of the User's last sign in.
/// </summary>
[JsonProperty("last_sign_in_at")]
public string LastSignInAt { get; set; }

/// <summary>
/// The User's external identifier.
/// </summary>
[JsonProperty("external_id")]
public string ExternalId { get; set; }

/// <summary>
/// The User's metadata.
/// </summary>
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }

/// <summary>
/// The User's locale.
/// </summary>
[JsonProperty("locale")]
public string Locale { get; set; }

/// <summary>
/// The timestamp of when the User was created.
/// </summary>
[JsonProperty("created_at")]
public string CreatedAt { get; set; }

/// <summary>
/// The timestamp of when the User was updated.
/// </summary>
[JsonProperty("updated_at")]
public string UpdatedAt { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace WorkOS
{
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

/// <summary>
/// An enum describing the authentication method used to authenticate a user.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum AuthenticationMethod
{
[EnumMember(Value = "SSO")]
SSO,

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

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

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

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

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

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

[EnumMember(Value = "Impersonation")]
Impersonation,
}
}
Loading