Skip to content

Commit

Permalink
Merge pull request #42 from mdsol/develop
Browse files Browse the repository at this point in the history
Release of v3.1.1
  • Loading branch information
lschreck-mdsol authored Oct 18, 2018
2 parents 1227b4f + 162695c commit be699e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changes in Medidata.MAuth

## v3.1.1
- **[Core]** Added `ConfigureAwait(false)` avoiding any possible deadlocks.

## v3.1.0
- **[Core]** Added a new extension method to the utilities which will authenticate a `HttpRequestMessage` with the
provided options.
Expand Down
8 changes: 4 additions & 4 deletions src/Medidata.MAuth.Core/MAuthCoreExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal static class MAuthCoreExtensions
public static async Task<string> CalculatePayload(
this HttpRequestMessage request, PrivateKeyAuthenticationInfo authInfo)
{
var unsignedData = await request.GetSignature(authInfo);
var unsignedData = await request.GetSignature(authInfo).ConfigureAwait(false);
var signer = new Pkcs1Encoding(new RsaEngine());
signer.Init(true, authInfo.PrivateKey.AsCipherParameters());

Expand Down Expand Up @@ -77,7 +77,7 @@ public static async Task<byte[]> GetSignature(this HttpRequestMessage request, A
{
request.Method.Method.ToBytes(), Constants.NewLine,
request.RequestUri.AbsolutePath.ToBytes(), Constants.NewLine,
(request.Content != null ? await request.Content.ReadAsByteArrayAsync() : new byte[] { }),
(request.Content != null ? await request.Content.ReadAsByteArrayAsync().ConfigureAwait(false) : new byte[] { }),
Constants.NewLine,
authInfo.ApplicationUuid.ToHyphenString().ToBytes(), Constants.NewLine,
authInfo.SignedTime.ToUnixTimeSeconds().ToString().ToBytes()
Expand Down Expand Up @@ -127,7 +127,7 @@ public async static Task<HttpRequestMessage> AddAuthenticationInfo(
{
var authHeader =
$"MWS {authInfo.ApplicationUuid.ToHyphenString()}:" +
$"{await request.CalculatePayload(authInfo)}";
$"{await request.CalculatePayload(authInfo).ConfigureAwait(false)}";

request.Headers.Add(Constants.MAuthHeaderKey, authHeader);
request.Headers.Add(Constants.MAuthTimeHeaderKey, authInfo.SignedTime.ToUnixTimeSeconds().ToString());
Expand Down Expand Up @@ -159,7 +159,7 @@ public static Task<HttpRequestMessage> Sign(
/// <returns>A Task object which will result the application information when it completes.</returns>
public async static Task<ApplicationInfo> FromResponse(this HttpContent content)
{
var jsonObject = JObject.Parse(await content.ReadAsStringAsync());
var jsonObject = JObject.Parse(await content.ReadAsStringAsync().ConfigureAwait(false));

return jsonObject.GetValue("security_token").ToObject<ApplicationInfo>();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Medidata.MAuth.Core/MAuthSigningHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected async override Task<HttpResponseMessage> SendAsync(
InnerHandler = new HttpClientHandler();

return await base
.SendAsync(await request.Sign(options), cancellationToken)
.SendAsync(await request.Sign(options).ConfigureAwait(false), cancellationToken)
.ConfigureAwait(continueOnCapturedContext: false);
}
}
Expand Down
2 changes: 1 addition & 1 deletion version.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>3.1.0</Version>
<Version>3.1.1</Version>
</PropertyGroup>
</Project>

0 comments on commit be699e4

Please sign in to comment.