AttestationToken.ValidateTokenAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Validate a JSON Web Token returned by the MAA.
The token must have been signed by one ofattestationSigningCertificates. Certificates and keys carried in
the token itself are never trusted to sign it.
public virtual System.Threading.Tasks.Task<bool> ValidateTokenAsync(Azure.Security.Attestation.AttestationTokenValidationOptions options, System.Collections.Generic.IReadOnlyList<Azure.Security.Attestation.AttestationSigner> attestationSigningCertificates, System.Threading.CancellationToken cancellationToken = default);
abstract member ValidateTokenAsync : Azure.Security.Attestation.AttestationTokenValidationOptions * System.Collections.Generic.IReadOnlyList<Azure.Security.Attestation.AttestationSigner> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
override this.ValidateTokenAsync : Azure.Security.Attestation.AttestationTokenValidationOptions * System.Collections.Generic.IReadOnlyList<Azure.Security.Attestation.AttestationSigner> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Overridable Function ValidateTokenAsync (options As AttestationTokenValidationOptions, attestationSigningCertificates As IReadOnlyList(Of AttestationSigner), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)
Parameters
Options used while validating the attestation token.
- attestationSigningCertificates
- IReadOnlyList<AttestationSigner>
The signing certificates trusted to have signed the token, such as those returned by GetSigningCertificatesAsync(CancellationToken) for the attestation provider the token must come from.
- cancellationToken
- CancellationToken
Token used to cancel this operation if necessary.
Returns
true if the token was valid, false otherwise.
Exceptions
Thrown if options or attestationSigningCertificates is null, attestationSigningCertificates contains null, or ValidateIssuer is true and ExpectedIssuer is null.
Thrown if attestationSigningCertificates is empty, or one of its signers has no signing certificate.
Thrown if validation fails.
Remarks
An unsecured token (one whose Algorithm is "none") carries no signature and never passes validation, regardless of any handler attached to TokenValidated. Neither does a token without an algorithm.