Skip to content

Commit f44257a

Browse files
committed
Simplify AwsV4aAuthScheme.
Now that the signer is managed, we create it at static initialization.
1 parent 8e4c132 commit f44257a

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

sdk/src/Core/Amazon.Runtime/Credentials/Internal/AwsV4aAuthScheme.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
using System.Threading;
1716
using Amazon.Runtime.Identity;
1817
using Amazon.Runtime.Internal.Auth;
1918

@@ -25,7 +24,7 @@ namespace Amazon.Runtime.Credentials.Internal
2524
/// </summary>
2625
public class AwsV4aAuthScheme : IAuthScheme<AWSCredentials>
2726
{
28-
private static ISigner _signer;
27+
private static readonly ISigner _signer = new AWS4aSigner();
2928

3029
/// <inheritdoc/>
3130
public string SchemeId => AuthSchemeOption.SigV4A;
@@ -35,14 +34,6 @@ public IIdentityResolver GetIdentityResolver(IIdentityResolverConfiguration conf
3534
=> configuration.GetIdentityResolver<AWSCredentials>();
3635

3736
/// <inheritdoc/>
38-
public ISigner Signer()
39-
{
40-
if (_signer == null)
41-
{
42-
Interlocked.Exchange(ref _signer, new AWS4aSigner());
43-
}
44-
45-
return _signer;
46-
}
37+
public ISigner Signer() => _signer;
4738
}
4839
}

0 commit comments

Comments
 (0)