Skip to content

Commit dc97f28

Browse files
committed
Adds support for email verification_method in ConnectionOptions
1 parent 23009d0 commit dc97f28

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/Auth0.ManagementApi/Models/Connections/ConnectionOptionsEmailAttribute.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
using System.Runtime.Serialization;
2+
13
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
25

36
namespace Auth0.ManagementApi.Models.Connections
47
{
@@ -12,5 +15,30 @@ public class ConnectionOptionsEmailAttribute : ConnectionOptionsAttributeBase
1215
/// </summary>
1316
[JsonProperty("signup")]
1417
public ConnectionOptionsEmailSignup Signup { get; set; }
18+
19+
/// <summary>
20+
/// Gets or sets the verification method for email.
21+
/// </summary>
22+
[JsonConverter(typeof(StringEnumConverter))]
23+
[JsonProperty("verification_method")]
24+
public ConnectionOptionsEmailVerificationMethod? VerificationMethod { get; set; }
25+
}
26+
27+
/// <summary>
28+
/// Verification methods for email authentication
29+
/// </summary>
30+
public enum ConnectionOptionsEmailVerificationMethod
31+
{
32+
/// <summary>
33+
/// Use magic link for verification
34+
/// </summary>
35+
[EnumMember(Value = "link")]
36+
Link,
37+
38+
/// <summary>
39+
/// Use one-time password for verification
40+
/// </summary>
41+
[EnumMember(Value = "otp")]
42+
Otp
1543
}
1644
}

tests/Auth0.ManagementApi.IntegrationTests/ConnectionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.Collections.Generic;
1212
using Auth0.AuthenticationApi.Models;
1313
using Auth0.ManagementApi.Models.Connections;
14-
using Auth0.Tests.Shared;
1514
using Newtonsoft.Json;
1615

1716
namespace Auth0.ManagementApi.IntegrationTests
@@ -506,7 +505,8 @@ private ConnectionOptions GetConnectionOptionsRequest()
506505
{
507506
Active = false
508507
}
509-
}
508+
},
509+
VerificationMethod = ConnectionOptionsEmailVerificationMethod.Otp
510510
},
511511
PhoneNumber = new ConnectionOptionsPhoneNumberAttribute()
512512
{

0 commit comments

Comments
 (0)