Skip to content

Commit 89d9ce5

Browse files
feat(generated): UserManagement, Radar (batch f510ddfb) (#281)
Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com>
1 parent 48c966f commit 89d9ce5

45 files changed

Lines changed: 327 additions & 111 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
* [#281](https://github.com/workos/workos-dotnet/pull/281) fix(generated): regenerate from spec
2+
3+
**Features**
4+
* **[user_management](https://workos.com/docs/reference/authkit/user)**:
5+
* Added model `UserRoleAssignmentSource`
6+
* Added `source` to `UserRoleAssignment`
7+
* Added enum `UserRoleAssignmentSourceType`
8+
* Added parameter `UserManagementAuthentication.authorize.max_age`
9+
* Added endpoint `GET /user_management/cors_origins`
10+
* Added endpoint `GET /user_management/redirect_uris`
11+
12+
**Fixes**
13+
* Restore mistakenly removed CreateMagicAuth logic from previous release

.last-synced-sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4b4e0618779460dbebc1cf5e0f02197c21796d1f
1+
23faa38318d596e581656934ed72c4a18476d742

.oagen-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"version": 2,
33
"language": "dotnet",
4-
"generatedAt": "2026-07-02T17:29:50.293Z",
54
"files": [
65
"src/WorkOS.net/Client/Utilities/AgentRegistrationCredentialIssuedDataDetailDiscriminatorConverter.cs",
76
"src/WorkOS.net/Client/Utilities/ApiKeyCreatedDataOwnerDiscriminatorConverter.cs",
@@ -294,6 +293,7 @@
294293
"src/WorkOS.net/Entities/UserAuthenticationFactorEnrollResponse.cs",
295294
"src/WorkOS.net/Entities/UserConsentOption.cs",
296295
"src/WorkOS.net/Entities/UserConsentOptionChoice.cs",
296+
"src/WorkOS.net/Entities/UserCreateResponse.cs",
297297
"src/WorkOS.net/Entities/UserCreated.cs",
298298
"src/WorkOS.net/Entities/UserDeleted.cs",
299299
"src/WorkOS.net/Entities/UserIdentitiesGetItem.cs",

src/WorkOS.net/Entities/MagicAuthSendMagicAuthCodeAndReturnResponse.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,36 @@
22

33
namespace WorkOS
44
{
5+
using System;
56

67
/// <summary>Represents a magic auth send magic auth code and return response.</summary>
78
public class MagicAuthSendMagicAuthCodeAndReturnResponse
89
{
910

11+
/// <summary>Distinguishes the Magic Auth object.</summary>
12+
public string Object { get; internal set; } = "magic_auth";
13+
14+
/// <summary>The unique ID of the Magic Auth code.</summary>
15+
public string Id { get; set; } = default!;
16+
17+
/// <summary>The unique ID of the user.</summary>
18+
public string UserId { get; set; } = default!;
19+
20+
/// <summary>The email address of the user.</summary>
21+
public string Email { get; set; } = default!;
22+
23+
/// <summary>The timestamp when the Magic Auth code expires.</summary>
24+
public DateTimeOffset ExpiresAt { get; set; }
25+
26+
/// <summary>An ISO 8601 timestamp.</summary>
27+
public DateTimeOffset CreatedAt { get; set; }
28+
29+
/// <summary>An ISO 8601 timestamp.</summary>
30+
public DateTimeOffset UpdatedAt { get; set; }
31+
32+
/// <summary>The code used to verify the Magic Auth code.</summary>
33+
public string Code { get; set; } = default!;
34+
1035
/// <summary>The ID of the Radar authentication attempt created for this request when Radar is enabled. Pass this value to the authenticate endpoint to associate the subsequent authentication with this Radar attempt.</summary>
1136
public string? RadarAuthAttemptId { get; set; }
1237
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// This file is auto-generated by oagen. Do not edit.
2+
3+
namespace WorkOS
4+
{
5+
using System;
6+
using System.Collections.Generic;
7+
8+
/// <summary>Represents an user create response.</summary>
9+
public class UserCreateResponse
10+
{
11+
12+
/// <summary>Distinguishes the user object.</summary>
13+
public string Object { get; internal set; } = "user";
14+
15+
/// <summary>The unique ID of the user.</summary>
16+
public string Id { get; set; } = default!;
17+
18+
/// <summary>The first name of the user.</summary>
19+
public string? FirstName { get; set; }
20+
21+
/// <summary>The last name of the user.</summary>
22+
public string? LastName { get; set; }
23+
24+
/// <summary>The user's full name.</summary>
25+
public string? Name { get; set; }
26+
27+
/// <summary>A URL reference to an image representing the user.</summary>
28+
public string? ProfilePictureUrl { get; set; }
29+
30+
/// <summary>The email address of the user.</summary>
31+
public string Email { get; set; } = default!;
32+
33+
/// <summary>Whether the user's email has been verified.</summary>
34+
public bool EmailVerified { get; set; }
35+
36+
/// <summary>The external ID of the user.</summary>
37+
public string? ExternalId { get; set; }
38+
39+
/// <summary>Object containing metadata key/value pairs associated with the user.</summary>
40+
public Dictionary<string, string>? Metadata { get; set; }
41+
42+
/// <summary>The timestamp when the user last signed in.</summary>
43+
public DateTimeOffset? LastSignInAt { get; set; }
44+
45+
/// <summary>The user's preferred locale.</summary>
46+
public string? Locale { get; set; }
47+
48+
/// <summary>An ISO 8601 timestamp.</summary>
49+
public DateTimeOffset CreatedAt { get; set; }
50+
51+
/// <summary>An ISO 8601 timestamp.</summary>
52+
public DateTimeOffset UpdatedAt { get; set; }
53+
54+
/// <summary>The ID of the Radar authentication attempt created for this request when Radar is enabled. Pass this value to the authenticate endpoint to associate the subsequent authentication with this Radar attempt.</summary>
55+
public string? RadarAuthAttemptId { get; set; }
56+
}
57+
}

src/WorkOS.net/Services/UserManagement/UserManagementService.cs

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,44 @@ public Task<AuthenticateResponse> AuthenticateWithDeviceCode(AuthenticateWithDev
195195
return this.AuthenticateWithDeviceCodeAsync(options, requestOptions, cancellationToken);
196196
}
197197

198+
/// <summary>Authenticate with radar email challenge.</summary>
199+
/// <param name="options">Request options.</param>
200+
/// <param name="requestOptions">Per-request configuration overrides.</param>
201+
/// <param name="cancellationToken">Cancellation token.</param>
202+
/// <returns>The <see cref="AuthenticateResponse"/> result.</returns>
203+
public async Task<AuthenticateResponse> AuthenticateWithRadarEmailChallengeAsync(AuthenticateWithRadarEmailChallengeOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
204+
{
205+
options.GrantType = "urn:workos:oauth:grant-type:radar-email-challenge:code";
206+
options.ClientId = this.Client.RequireClientId();
207+
options.ClientSecret = this.Client.ApiKey ?? string.Empty;
208+
return await this.PostAsync<AuthenticateResponse>("/user_management/authenticate", options, requestOptions, cancellationToken);
209+
}
210+
211+
/// <summary>Compatibility wrapper for <see cref="AuthenticateWithRadarEmailChallengeAsync"/>.</summary>
212+
public Task<AuthenticateResponse> AuthenticateWithRadarEmailChallenge(AuthenticateWithRadarEmailChallengeOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
213+
{
214+
return this.AuthenticateWithRadarEmailChallengeAsync(options, requestOptions, cancellationToken);
215+
}
216+
217+
/// <summary>Authenticate with radar sms challenge.</summary>
218+
/// <param name="options">Request options.</param>
219+
/// <param name="requestOptions">Per-request configuration overrides.</param>
220+
/// <param name="cancellationToken">Cancellation token.</param>
221+
/// <returns>The <see cref="AuthenticateResponse"/> result.</returns>
222+
public async Task<AuthenticateResponse> AuthenticateWithRadarSmsChallengeAsync(AuthenticateWithRadarSmsChallengeOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
223+
{
224+
options.GrantType = "urn:workos:oauth:grant-type:radar-sms-challenge:code";
225+
options.ClientId = this.Client.RequireClientId();
226+
options.ClientSecret = this.Client.ApiKey ?? string.Empty;
227+
return await this.PostAsync<AuthenticateResponse>("/user_management/authenticate", options, requestOptions, cancellationToken);
228+
}
229+
230+
/// <summary>Compatibility wrapper for <see cref="AuthenticateWithRadarSmsChallengeAsync"/>.</summary>
231+
public Task<AuthenticateResponse> AuthenticateWithRadarSmsChallenge(AuthenticateWithRadarSmsChallengeOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
232+
{
233+
return this.AuthenticateWithRadarSmsChallengeAsync(options, requestOptions, cancellationToken);
234+
}
235+
198236
/// <summary>Get an authorization URL</summary>
199237
/// <remarks>
200238
/// Generates an OAuth 2.0 authorization URL to authenticate a user with AuthKit or SSO.
@@ -448,8 +486,8 @@ public virtual IAsyncEnumerable<User> ListAutoPagingAsync(UserManagementListOpti
448486
/// <param name="options">Request options.</param>
449487
/// <param name="requestOptions">Per-request configuration overrides.</param>
450488
/// <param name="cancellationToken">Cancellation token.</param>
451-
/// <returns>The <see cref="MagicAuthSendMagicAuthCodeAndReturnResponse"/> result.</returns>
452-
public virtual async Task<MagicAuthSendMagicAuthCodeAndReturnResponse> CreateAsync(UserManagementCreateOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
489+
/// <returns>The <see cref="UserCreateResponse"/> result.</returns>
490+
public virtual async Task<UserCreateResponse> CreateAsync(UserManagementCreateOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
453491
{
454492
var request = new WorkOSRequest
455493
{
@@ -476,11 +514,11 @@ public virtual async Task<MagicAuthSendMagicAuthCodeAndReturnResponse> CreateAsy
476514
request.AddBodyParam("password_hash_type", JsonConvert.SerializeObject(hashed.PasswordHashType).Trim('"'));
477515
}
478516

479-
return await this.Client.MakeAPIRequest<MagicAuthSendMagicAuthCodeAndReturnResponse>(request, cancellationToken);
517+
return await this.Client.MakeAPIRequest<UserCreateResponse>(request, cancellationToken);
480518
}
481519

482520
/// <summary>Compatibility wrapper for <see cref="CreateAsync"/>.</summary>
483-
public virtual Task<MagicAuthSendMagicAuthCodeAndReturnResponse> Create(UserManagementCreateOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
521+
public virtual Task<UserCreateResponse> Create(UserManagementCreateOptions options, RequestOptions? requestOptions = null, CancellationToken cancellationToken = default)
484522
{
485523
return this.CreateAsync(options, requestOptions, cancellationToken);
486524
}

src/WorkOS.net/Services/UserManagement/_interfaces/UserManagementWrapperOptions.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ public class AuthenticateWithPasswordOptions : BaseOptions
2626
/// <summary>The user agent string from the user's browser.</summary>
2727
public string? UserAgent { get; set; }
2828

29+
/// <summary>An optional Radar signals ID to correlate client-side signals with this authentication attempt.</summary>
30+
public string? SignalsId { get; set; }
31+
32+
/// <summary>The ID of an existing Radar authentication attempt to associate with this authentication.</summary>
33+
public string? RadarAuthAttemptId { get; set; }
34+
2935
internal string GrantType { get; set; } = default!;
3036

3137
internal string ClientId { get; set; } = default!;
@@ -54,6 +60,9 @@ public class AuthenticateWithCodeOptions : BaseOptions
5460
/// <summary>The user agent string from the user's browser.</summary>
5561
public string? UserAgent { get; set; }
5662

63+
/// <summary>An optional Radar signals ID to correlate client-side signals with this authentication attempt.</summary>
64+
public string? SignalsId { get; set; }
65+
5766
internal string GrantType { get; set; } = default!;
5867

5968
internal string ClientId { get; set; } = default!;
@@ -101,6 +110,8 @@ public class AuthenticateWithMagicAuthOptions : BaseOptions
101110

102111
public string? UserAgent { get; set; }
103112

113+
public string? RadarAuthAttemptId { get; set; }
114+
104115
internal string GrantType { get; set; } = default!;
105116

106117
internal string ClientId { get; set; } = default!;
@@ -186,4 +197,50 @@ public class AuthenticateWithDeviceCodeOptions : BaseOptions
186197
internal string ClientId { get; set; } = default!;
187198

188199
}
200+
201+
public class AuthenticateWithRadarEmailChallengeOptions : BaseOptions
202+
{
203+
public string Code { get; set; } = default!;
204+
205+
public string RadarChallengeId { get; set; } = default!;
206+
207+
public string PendingAuthenticationToken { get; set; } = default!;
208+
209+
public string? IpAddress { get; set; }
210+
211+
public string? DeviceId { get; set; }
212+
213+
public string? UserAgent { get; set; }
214+
215+
internal string GrantType { get; set; } = default!;
216+
217+
internal string ClientId { get; set; } = default!;
218+
219+
internal string ClientSecret { get; set; } = default!;
220+
221+
}
222+
223+
public class AuthenticateWithRadarSmsChallengeOptions : BaseOptions
224+
{
225+
public string Code { get; set; } = default!;
226+
227+
public string VerificationId { get; set; } = default!;
228+
229+
public string PhoneNumber { get; set; } = default!;
230+
231+
public string PendingAuthenticationToken { get; set; } = default!;
232+
233+
public string? IpAddress { get; set; }
234+
235+
public string? DeviceId { get; set; }
236+
237+
public string? UserAgent { get; set; }
238+
239+
internal string GrantType { get; set; } = default!;
240+
241+
internal string ClientId { get; set; } = default!;
242+
243+
internal string ClientSecret { get; set; } = default!;
244+
245+
}
189246
}

test/WorkOSTests/Tests/UserManagementServiceTest.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,14 @@ public async Task TestListAsyncEmpty()
209209
[Fact]
210210
public async Task TestCreateAsync()
211211
{
212-
var fixture = System.IO.File.ReadAllText("testdata/magic_auth_send_magic_auth_code_and_return_response.json");
212+
var fixture = System.IO.File.ReadAllText("testdata/user_create_response.json");
213213
this.httpMock.MockResponse(HttpMethod.Post, "/user_management/users", HttpStatusCode.OK, fixture);
214214
var options = new UserManagementCreateOptions();
215215
options.Email = "test_email";
216216
var result = await this.service.CreateAsync(options);
217217
Assert.NotNull(result);
218+
Assert.Equal("user_01E4ZCR3C56J083X43JQXF3JK5", result.Id);
219+
Assert.Equal("marcelina.davis@example.com", result.Email);
218220
this.httpMock.AssertRequestWasMade(HttpMethod.Post, "/user_management/users");
219221
await this.httpMock.AssertRequestBodyContainsAsync("email", "test_email");
220222
}
@@ -480,6 +482,9 @@ public async Task TestCreateMagicAuthAsync()
480482
options.Email = "test_email";
481483
var result = await this.service.CreateMagicAuthAsync(options);
482484
Assert.NotNull(result);
485+
Assert.Equal("magic_auth_01HWZBQZY2M3AMQW166Q22K88F", result.Id);
486+
Assert.Equal("user_01E4ZCR3C56J083X43JQXF3JK5", result.UserId);
487+
Assert.Equal("marcelina.davis@example.com", result.Email);
483488
this.httpMock.AssertRequestWasMade(HttpMethod.Post, "/user_management/magic_auth");
484489
await this.httpMock.AssertRequestBodyContainsAsync("email", "test_email");
485490
}
@@ -903,6 +908,26 @@ public async Task TestAuthenticateWithDeviceCodeAsync()
903908
this.httpMock.AssertRequestWasMade(HttpMethod.Post, "/user_management/authenticate");
904909
}
905910

911+
[Fact]
912+
public async Task TestAuthenticateWithRadarEmailChallengeAsync()
913+
{
914+
var fixture = System.IO.File.ReadAllText("testdata/authenticate_response.json");
915+
this.httpMock.MockResponse(HttpMethod.Post, "/user_management/authenticate", HttpStatusCode.OK, fixture);
916+
var result = await this.service.AuthenticateWithRadarEmailChallengeAsync(new AuthenticateWithRadarEmailChallengeOptions());
917+
Assert.NotNull(result);
918+
this.httpMock.AssertRequestWasMade(HttpMethod.Post, "/user_management/authenticate");
919+
}
920+
921+
[Fact]
922+
public async Task TestAuthenticateWithRadarSmsChallengeAsync()
923+
{
924+
var fixture = System.IO.File.ReadAllText("testdata/authenticate_response.json");
925+
this.httpMock.MockResponse(HttpMethod.Post, "/user_management/authenticate", HttpStatusCode.OK, fixture);
926+
var result = await this.service.AuthenticateWithRadarSmsChallengeAsync(new AuthenticateWithRadarSmsChallengeOptions());
927+
Assert.NotNull(result);
928+
this.httpMock.AssertRequestWasMade(HttpMethod.Post, "/user_management/authenticate");
929+
}
930+
906931
[Fact]
907932
public async Task TestError401()
908933
{

test/WorkOSTests/testdata/authenticate_response.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"id": "user_01E4ZCR3C56J083X43JQXF3JK5",
55
"first_name": "Marcelina",
66
"last_name": "Davis",
7+
"name": "Marcelina Davis",
78
"profile_picture_url": "https://workoscdn.com/images/v1/123abc",
89
"email": "marcelina.davis@example.com",
910
"email_verified": true,
@@ -14,8 +15,7 @@
1415
"last_sign_in_at": "2025-06-25T19:07:33.155Z",
1516
"locale": "en-US",
1617
"created_at": "2026-01-15T12:00:00.000Z",
17-
"updated_at": "2026-01-15T12:00:00.000Z",
18-
"name": "Marcelina Davis"
18+
"updated_at": "2026-01-15T12:00:00.000Z"
1919
},
2020
"organization_id": "org_01H945H0YD4F97JN9MATX7BYAG",
2121
"authkit_authorization_code": "authkit_authz_code_abc123",

test/WorkOSTests/testdata/authenticate_response_nulls.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"id": "user_01E4ZCR3C56J083X43JQXF3JK5",
55
"first_name": "Marcelina",
66
"last_name": "Davis",
7+
"name": "Marcelina Davis",
78
"profile_picture_url": "https://workoscdn.com/images/v1/123abc",
89
"email": "marcelina.davis@example.com",
910
"email_verified": true,
@@ -14,8 +15,7 @@
1415
"last_sign_in_at": "2025-06-25T19:07:33.155Z",
1516
"locale": "en-US",
1617
"created_at": "2026-01-15T12:00:00.000Z",
17-
"updated_at": "2026-01-15T12:00:00.000Z",
18-
"name": "Marcelina Davis"
18+
"updated_at": "2026-01-15T12:00:00.000Z"
1919
},
2020
"organization_id": null,
2121
"authkit_authorization_code": null,

0 commit comments

Comments
 (0)