Skip to content

Commit 9e8679c

Browse files
authored
revert AzureSasCredentialSynchronousPolicy changes (#33365)
1 parent c4edaae commit 9e8679c

File tree

8 files changed

+2
-63
lines changed

8 files changed

+2
-63
lines changed

sdk/core/Azure.Core/api/Azure.Core.net461.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ public partial class AzureSasCredential
4040
{
4141
public AzureSasCredential(string signature) { }
4242
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
43-
public string PreviousSignature { get { throw null; } }
44-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
4543
public string Signature { get { throw null; } }
46-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
47-
public long SignatureUpdated { get { throw null; } }
4844
public void Update(string signature) { }
4945
}
5046
[System.FlagsAttribute]

sdk/core/Azure.Core/api/Azure.Core.net5.0.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ public partial class AzureSasCredential
4040
{
4141
public AzureSasCredential(string signature) { }
4242
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
43-
public string PreviousSignature { get { throw null; } }
44-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
4543
public string Signature { get { throw null; } }
46-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
47-
public long SignatureUpdated { get { throw null; } }
4844
public void Update(string signature) { }
4945
}
5046
[System.FlagsAttribute]

sdk/core/Azure.Core/api/Azure.Core.net6.0.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ public partial class AzureSasCredential
4040
{
4141
public AzureSasCredential(string signature) { }
4242
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
43-
public string PreviousSignature { get { throw null; } }
44-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
4543
public string Signature { get { throw null; } }
46-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
47-
public long SignatureUpdated { get { throw null; } }
4844
public void Update(string signature) { }
4945
}
5046
[System.FlagsAttribute]

sdk/core/Azure.Core/api/Azure.Core.netcoreapp2.1.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ public partial class AzureSasCredential
4040
{
4141
public AzureSasCredential(string signature) { }
4242
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
43-
public string PreviousSignature { get { throw null; } }
44-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
4543
public string Signature { get { throw null; } }
46-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
47-
public long SignatureUpdated { get { throw null; } }
4844
public void Update(string signature) { }
4945
}
5046
[System.FlagsAttribute]

sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ public partial class AzureSasCredential
4040
{
4141
public AzureSasCredential(string signature) { }
4242
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
43-
public string PreviousSignature { get { throw null; } }
44-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
4543
public string Signature { get { throw null; } }
46-
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
47-
public long SignatureUpdated { get { throw null; } }
4844
public void Update(string signature) { }
4945
}
5046
[System.FlagsAttribute]

sdk/core/Azure.Core/src/AzureSasCredential.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ namespace Azure
1717
public class AzureSasCredential
1818
{
1919
private string _signature;
20-
private string _previousSignature;
21-
private long _signatureUpdated;
2220

2321
/// <summary>
2422
/// Shared access signature used to authenticate to an Azure service.
@@ -30,27 +28,6 @@ public string Signature
3028
private set => Volatile.Write(ref _signature, value);
3129
}
3230

33-
/// <summary>
34-
/// The ticks value of the DateTimeOffset when the shared access signature was last set.
35-
/// </summary>
36-
[EditorBrowsable(EditorBrowsableState.Never)]
37-
public long SignatureUpdated
38-
{
39-
get => Volatile.Read(ref _signatureUpdated);
40-
private set => Volatile.Write(ref _signatureUpdated, value);
41-
}
42-
43-
/// <summary>
44-
/// The previous value af <see cref="Signature"/> after <see cref="Update"/> is called.
45-
/// </summary>
46-
/// <returns></returns>
47-
[EditorBrowsable(EditorBrowsableState.Never)]
48-
public string PreviousSignature
49-
{
50-
get => Volatile.Read(ref _previousSignature);
51-
private set => Volatile.Write(ref _previousSignature, value);
52-
}
53-
5431
/// <summary>
5532
/// Initializes a new instance of the <see cref="AzureSasCredential"/> class.
5633
/// </summary>
@@ -65,9 +42,7 @@ public string PreviousSignature
6542
public AzureSasCredential(string signature)
6643
{
6744
Argument.AssertNotNullOrWhiteSpace(signature, nameof(signature));
68-
SignatureUpdated = DateTimeOffset.UtcNow.Ticks;
6945
Signature = signature;
70-
PreviousSignature = signature;
7146
}
7247
#pragma warning restore CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
7348

@@ -86,9 +61,6 @@ public AzureSasCredential(string signature)
8661
public void Update(string signature)
8762
{
8863
Argument.AssertNotNullOrWhiteSpace(signature, nameof(signature));
89-
SignatureUpdated = DateTimeOffset.UtcNow.Ticks;
90-
PreviousSignature = Signature.StartsWith("?", StringComparison.InvariantCulture) ?
91-
Signature.Substring(1) : Signature;
9264
Signature = signature;
9365
}
9466
}

sdk/core/Azure.Core/src/Shared/AzureSasCredentialSynchronousPolicy.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,7 @@ public override void OnSendingRequest(HttpMessage message)
3131
}
3232
if (!query.Contains(signature))
3333
{
34-
bool setSignature = false;
35-
// check if the signature has updated since we started processing this message
36-
if (message.ProcessingContext.StartTime.Ticks < _credential.SignatureUpdated)
37-
{
38-
string previousSig = _credential.PreviousSignature;
39-
if (query.Contains(previousSig))
40-
{
41-
query = query.Replace(previousSig, signature);
42-
setSignature = true;
43-
}
44-
}
45-
if (!setSignature)
46-
{
47-
query = string.IsNullOrEmpty(query) ? '?' + signature : query + '&' + signature;
48-
}
34+
query = string.IsNullOrEmpty(query) ? '?' + signature : query + '&' + signature;
4935
message.Request.Uri.Query = query;
5036
}
5137

sdk/core/Azure.Core/tests/AzureSasCredentialSynchronousPolicyTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public async Task IgnoreDuplicateSas(string signatureValue)
9595
}
9696

9797
[Test]
98+
[Ignore("Re-enable when AzureSasCredential change merges")]
9899
public async Task VerifyRetryAfterSasCredentialUpdateOperation()
99100
{
100101
// Arrange

0 commit comments

Comments
 (0)