/// <summary> /// Create a deep copy of the current attestation token. /// </summary> /// <returns></returns> public AttestationTokenValidationOptions Clone() { var returnedToken = new AttestationTokenValidationOptions() { ValidateExpirationTime = this.ValidateExpirationTime, ValidateIssuer = this.ValidateIssuer, ExpectedIssuer = this.ExpectedIssuer, TimeValidationSlack = this.TimeValidationSlack, ValidateNotBeforeTime = this.ValidateNotBeforeTime, ValidateToken = this.ValidateToken, }; returnedToken.TokenValidated = this.TokenValidated; return(returnedToken); }
/// <summary>Initializes a new instance of the <see cref="AttestationClientOptions"/>.</summary> public AttestationClientOptions( ServiceVersion version = ServiceVersion.V2020_10_01, AttestationTokenValidationOptions tokenOptions = default ) { if (version == default) { throw new ArgumentException("The service version {version} is not supported by this library"); } Version = version switch { ServiceVersion.V2020_10_01 => "2020-10-01", _ => throw new ArgumentException($"The service version {version} is not supported by this library.", nameof(version)) }; // If the caller specified that they have token validation options, use them, otherwise // use the defaults. TokenOptions = tokenOptions != null?tokenOptions.Clone() : new AttestationTokenValidationOptions(); }