Skip to content

Commit 48e14b8

Browse files
committed
fix(SDK): Fixed AuthenticationSchemeDefinitions by removing required properties, which was resulting in ASP.NET Core incorrectly invalidating posted models
Signed-off-by: Charles d'Avernas <[email protected]>
1 parent a7890f7 commit 48e14b8

7 files changed

+9
-10
lines changed

src/ServerlessWorkflow.Sdk/Models/Authentication/BasicAuthenticationSchemeDefinition.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public record BasicAuthenticationSchemeDefinition
2929
/// Gets/sets the username used for authentication
3030
/// </summary>
3131
[DataMember(Name = "username", Order = 1), JsonPropertyName("username"), JsonPropertyOrder(1), YamlMember(Alias = "username", Order = 1)]
32-
public required virtual string Username { get; set; }
32+
public virtual string Username { get; set; } = null!;
3333

3434
/// <summary>
3535
/// Gets/sets the password used for authentication
3636
/// </summary>
3737
[DataMember(Name = "password", Order = 2), JsonPropertyName("password"), JsonPropertyOrder(2), YamlMember(Alias = "password", Order = 2)]
38-
public required virtual string Password { get; set; }
38+
public virtual string Password { get; set; } = null!;
3939

4040
}

src/ServerlessWorkflow.Sdk/Models/Authentication/BearerAuthenticationSchemeDefinition.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public record BearerAuthenticationSchemeDefinition
2929
/// Gets/sets the bearer token used for authentication
3030
/// </summary>
3131
[DataMember(Name = "token", Order = 1), JsonPropertyName("token"), JsonPropertyOrder(1), YamlMember(Alias = "token", Order = 1)]
32-
public required virtual string Token { get; set; }
32+
public virtual string Token { get; set; } = null!;
3333

3434
}

src/ServerlessWorkflow.Sdk/Models/Authentication/DigestAuthenticationSchemeDefinition.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public record DigestAuthenticationSchemeDefinition
2929
/// Gets/sets the username used for authentication
3030
/// </summary>
3131
[DataMember(Name = "username", Order = 1), JsonPropertyName("username"), JsonPropertyOrder(1), YamlMember(Alias = "username", Order = 1)]
32-
public required virtual string Username { get; set; }
32+
public virtual string Username { get; set; } = null!;
3333

3434
/// <summary>
3535
/// Gets/sets the password used for authentication
3636
/// </summary>
3737
[DataMember(Name = "password", Order = 2), JsonPropertyName("password"), JsonPropertyOrder(2), YamlMember(Alias = "password", Order = 2)]
38-
public required virtual string Password { get; set; }
38+
public virtual string Password { get; set; } = null!;
3939

4040
}

src/ServerlessWorkflow.Sdk/Models/Authentication/OAuth2AuthenticationSchemeDefinitionBase.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public abstract record OAuth2AuthenticationSchemeDefinitionBase
2525
/// Gets/sets the uri that references the OAUTH2 authority to use
2626
/// </summary>
2727
[DataMember(Name = "authority", Order = 1), JsonPropertyName("authority"), JsonPropertyOrder(1), YamlMember(Alias = "authority", Order = 1)]
28-
public required virtual Uri Authority { get; set; }
28+
public virtual Uri? Authority { get; set; }
2929

3030
/// <summary>
3131
/// Gets/sets the grant type to use. See <see cref="OAuth2GrantType"/>
3232
/// </summary>
3333
[DataMember(Name = "grant", Order = 2), JsonPropertyName("grant"), JsonPropertyOrder(2), YamlMember(Alias = "grant", Order = 2)]
34-
public required virtual string Grant { get; set; }
34+
public virtual string? Grant { get; set; }
3535

3636
/// <summary>
3737
/// Gets/sets the definition of the client to use

src/ServerlessWorkflow.Sdk/Models/AuthenticationPolicyDefinition.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public record AuthenticationPolicyDefinition
2727
/// Gets the configured authentication scheme
2828
/// </summary>
2929
[IgnoreDataMember, JsonIgnore, YamlIgnore]
30-
public virtual string Scheme => this.Basic?.Scheme ?? this.Bearer?.Scheme ?? this.OAuth2?.Scheme ?? throw new NullReferenceException();
30+
public virtual string Scheme => this.Basic?.Scheme ?? this.Bearer?.Scheme ?? this.Certificate?.Scheme ?? this.Digest?.Scheme ?? this.OAuth2?.Scheme ?? this.Oidc?.Scheme ?? throw new NullReferenceException();
3131

3232
/// <summary>
3333
/// Gets/sets the name of the top level authentication policy to use, if any

src/ServerlessWorkflow.Sdk/ServerlessWorkflow.Sdk.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
3737
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
3838
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
39-
<PackageReference Include="Neuroglia.Serialization.YamlDotNet" Version="4.15.0" />
39+
<PackageReference Include="Neuroglia.Serialization.YamlDotNet" Version="4.15.3" />
4040
<PackageReference Include="Semver" Version="2.3.0" />
4141
</ItemGroup>
4242

tests/ServerlessWorkflow.Sdk.UnitTests/Cases/IO/WorkflowDefinitionIOTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313

1414
using ServerlessWorkflow.Sdk.IO;
15-
using ServerlessWorkflow.Sdk.Models.Calls;
1615

1716
namespace ServerlessWorkflow.Sdk.UnitTests.Cases.IO;
1817

0 commit comments

Comments
 (0)