/// <summary> /// Initializes a new instance of the <see cref="SharedAccessSignatureCredential"/> class. /// </summary> /// /// <param name="signature">The shared access signature on which to base the token.</param> /// public SharedAccessSignatureCredential(SharedAccessSignature signature) { Argument.AssertNotNull(signature, nameof(signature)); SharedAccessSignature = signature; }
private SharedAccessSignature SafeUpdateSharedAccessSignature(SharedAccessSignature cachedSignature, SharedAccessSignature updatedSignature) { var signature = Interlocked.CompareExchange(ref _sharedAccessSignature, updatedSignature, cachedSignature); // If the cached signature doesn't match the active one then the signature was not replaced because it had // already been updated by another caller; assume that active signature is correct and should be used. return(ReferenceEquals(signature, cachedSignature) ? updatedSignature : signature); }