Interface ICertificateAuthenticator
- Namespace
- NuvTools.Security.Certificate
- Assembly
- NuvTools.Security.dll
Authenticates a person by a digital certificate, in two steps: the server opens a challenge, the client signs it with the certificate's private key, and the server validates the signature.
public interface ICertificateAuthenticator
Remarks
The identity is read from the certificate on the server, after the provider confirmed possession of the private key and the trust chain. Call CompleteAsync(string?, CancellationToken) inside the sign-in operation itself and take the identity from its result — never from a value the client sends.
Methods
CompleteAsync(string?, CancellationToken)
Validates the signed challenge and reads the certificate's subject.
Task<CertificateAuthentication> CompleteAsync(string? token, CancellationToken cancellationToken = default)
Parameters
tokenstringThe token of the challenge the client signed.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<CertificateAuthentication>
The authentication result. An empty token, a failed validation or a communication failure yields Valid =
false(fail-closed).
StartAsync(CancellationToken)
Opens an authentication on the provider.
Task<CertificateChallenge> StartAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task<CertificateChallenge>
The challenge the client signs and sends back.
Exceptions
- Exception
The provider could not be reached or refused the request.