Skip to content

Commit 66b0f2f

Browse files
NFC-99 Review findings and fixes from rebase
1 parent 38eec6d commit 66b0f2f

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

example/src/WebEid.AspNetCore.Example/Signing/MobileSigningService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ internal sealed record RequestObject
143143

144144
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
145145
[JsonPropertyName("signing_certificate")]
146-
public string? SigningCertificate { get; init; } = null!;
146+
public string? SigningCertificate { get; init; }
147147

148148
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
149149
[JsonPropertyName("hash")]
150-
public string? Hash { get; init; } = null!;
150+
public string? Hash { get; init; }
151151

152152
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
153153
[JsonPropertyName("hash_function")]
154-
public string? HashFunction { get; init; } = null!;
154+
public string? HashFunction { get; init; }
155155
}
156156
}
157157
}

src/WebEid.Security.Tests/Validator/AuthTokenValidatonOcspTest.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ public void WhenOcspRequestTimeoutIsReachedThenValidationFails()
4040
.WithOcspRequestTimeout(TimeSpan.FromMilliseconds(1))
4141
.Build();
4242

43-
var exception = Assert.ThrowsAsync<UserCertificateOcspCheckFailedException>(() => authTokenValidator.Validate(authTokenValidator.Parse(ValidAuthTokenStr), ValidChallengeNonce));
44-
Assert.That(exception.InnerException, Is.TypeOf<TaskCanceledException>());
45-
Assert.That(exception.InnerException.Message, Does.Contain("The request was canceled due to the configured HttpClient.Timeout of"));
43+
Assert.ThrowsAsync<UserCertificateOcspCheckFailedException>(() => authTokenValidator.Validate(authTokenValidator.Parse(ValidAuthTokenStr), ValidChallengeNonce));
4644

4745
}
4846

src/WebEid.Security/Validator/AuthTokenValidatorBuilder.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace WebEid.Security.Validator
3535
public class AuthTokenValidatorBuilder
3636
{
3737
private readonly ILogger logger;
38-
private readonly IOcspClient ocspClient;
38+
private IOcspClient ocspClient;
3939
private readonly AuthTokenValidationConfiguration configuration = new AuthTokenValidationConfiguration();
4040

4141
/// <summary>
@@ -185,6 +185,14 @@ public AuthTokenValidatorBuilder WithDesignatedOcspServiceConfiguration(Designat
185185
public IAuthTokenValidator Build()
186186
{
187187
configuration.Validate();
188+
189+
if (configuration.IsUserCertificateRevocationCheckWithOcspEnabled && ocspClient == null)
190+
{
191+
ocspClient = new OcspClient(
192+
configuration.OcspRequestTimeout,
193+
logger);
194+
}
195+
188196
return new AuthTokenValidator(configuration, ocspClient, logger);
189197
}
190198
}

0 commit comments

Comments
 (0)