Skip to content

Commit

Permalink
Showing 32 changed files with 282 additions and 533 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

## v2.1.0
- Added support for .NET Core with netstandard1.4

## v2.0.0
- **[Medidata.MAuth.Core]** The `MAuthSigningHandler` is accepting an `MAuthSigningOptions` instance instead of
an `MAuthOptions` instance (which in turn set to be an abstract class)
19 changes: 0 additions & 19 deletions GlobalAssemblyInfo.cs

This file was deleted.

53 changes: 32 additions & 21 deletions Medidata.MAuth.sln
Original file line number Diff line number Diff line change
@@ -3,45 +3,56 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{32B2C923-2DAE-4E48-9671-00636E159896}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2A4336AA-6F7D-414B-AB2B-81A8F2E82A48}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B74DB39B-4FB3-4DB1-A9BF-526413E8040B}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
global.json = global.json
LICENSE.md = LICENSE.md
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Medidata.MAuth.Core", "src\Medidata.MAuth.Core\Medidata.MAuth.Core.csproj", "{7E7795B5-2A8F-4D97-9A75-2518C78260E5}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Medidata.MAuth.Core", "src\Medidata.MAuth.Core\Medidata.MAuth.Core.xproj", "{C9A9FECB-DB5B-40C3-B7CC-F0251853DDE6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{9ED6F311-EB68-440E-A178-5C5F140F2340}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Medidata.MAuth.Owin", "src\Medidata.MAuth.Owin\Medidata.MAuth.Owin.csproj", "{326914C1-A9C2-4CFA-ABF2-282A18492230}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Medidata.MAuth.Tests", "tests\Medidata.MAuth.Tests\Medidata.MAuth.Tests.xproj", "{A1940D71-52B3-42EC-B2DF-70782AFFF23C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Medidata.MAuth.WebApi", "src\Medidata.MAuth.WebApi\Medidata.MAuth.WebApi.csproj", "{487A299D-9DE1-4A40-AA43-D4A89E3EDC96}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Medidata.MAuth.Owin", "src\Medidata.MAuth.Owin\Medidata.MAuth.Owin.xproj", "{74308221-D7A5-4C15-86D2-62871655C24B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Medidata.MAuth.Tests", "tests\Medidata.MAuth.Tests\Medidata.MAuth.Tests.csproj", "{0C3CF95C-15C7-431A-B6A0-EC591240E315}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Medidata.MAuth.WebApi", "src\Medidata.MAuth.WebApi\Medidata.MAuth.WebApi.xproj", "{E557F648-6FE1-432E-A8D7-BD00C18E5176}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E7795B5-2A8F-4D97-9A75-2518C78260E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E7795B5-2A8F-4D97-9A75-2518C78260E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E7795B5-2A8F-4D97-9A75-2518C78260E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E7795B5-2A8F-4D97-9A75-2518C78260E5}.Release|Any CPU.Build.0 = Release|Any CPU
{326914C1-A9C2-4CFA-ABF2-282A18492230}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{326914C1-A9C2-4CFA-ABF2-282A18492230}.Debug|Any CPU.Build.0 = Debug|Any CPU
{326914C1-A9C2-4CFA-ABF2-282A18492230}.Release|Any CPU.ActiveCfg = Release|Any CPU
{326914C1-A9C2-4CFA-ABF2-282A18492230}.Release|Any CPU.Build.0 = Release|Any CPU
{487A299D-9DE1-4A40-AA43-D4A89E3EDC96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{487A299D-9DE1-4A40-AA43-D4A89E3EDC96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{487A299D-9DE1-4A40-AA43-D4A89E3EDC96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{487A299D-9DE1-4A40-AA43-D4A89E3EDC96}.Release|Any CPU.Build.0 = Release|Any CPU
{0C3CF95C-15C7-431A-B6A0-EC591240E315}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C3CF95C-15C7-431A-B6A0-EC591240E315}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C3CF95C-15C7-431A-B6A0-EC591240E315}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C3CF95C-15C7-431A-B6A0-EC591240E315}.Release|Any CPU.Build.0 = Release|Any CPU
{C9A9FECB-DB5B-40C3-B7CC-F0251853DDE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9A9FECB-DB5B-40C3-B7CC-F0251853DDE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9A9FECB-DB5B-40C3-B7CC-F0251853DDE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9A9FECB-DB5B-40C3-B7CC-F0251853DDE6}.Release|Any CPU.Build.0 = Release|Any CPU
{A1940D71-52B3-42EC-B2DF-70782AFFF23C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1940D71-52B3-42EC-B2DF-70782AFFF23C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1940D71-52B3-42EC-B2DF-70782AFFF23C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1940D71-52B3-42EC-B2DF-70782AFFF23C}.Release|Any CPU.Build.0 = Release|Any CPU
{74308221-D7A5-4C15-86D2-62871655C24B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74308221-D7A5-4C15-86D2-62871655C24B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74308221-D7A5-4C15-86D2-62871655C24B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74308221-D7A5-4C15-86D2-62871655C24B}.Release|Any CPU.Build.0 = Release|Any CPU
{E557F648-6FE1-432E-A8D7-BD00C18E5176}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E557F648-6FE1-432E-A8D7-BD00C18E5176}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E557F648-6FE1-432E-A8D7-BD00C18E5176}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E557F648-6FE1-432E-A8D7-BD00C18E5176}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C9A9FECB-DB5B-40C3-B7CC-F0251853DDE6} = {2A4336AA-6F7D-414B-AB2B-81A8F2E82A48}
{A1940D71-52B3-42EC-B2DF-70782AFFF23C} = {9ED6F311-EB68-440E-A178-5C5F140F2340}
{74308221-D7A5-4C15-86D2-62871655C24B} = {2A4336AA-6F7D-414B-AB2B-81A8F2E82A48}
{E557F648-6FE1-432E-A8D7-BD00C18E5176} = {2A4336AA-6F7D-414B-AB2B-81A8F2E82A48}
EndGlobalSection
EndGlobal
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -232,8 +232,7 @@ in your project in order to make Medidata.MAuth work for you.

##### Is there an ASP.NET Core support?

Currently we do not support the ASP.NET Core applications, but we built this framework with extensibility in mind,
so in the near future there is a possibility that we will add a new package with the ASP.NET Core support.
Yes, we support .NET Core with netstandard1.4.

##### What Cryptographic provider is used for the encryption/decryption?

6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"projects": [ "src", "tests" ],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}
9 changes: 8 additions & 1 deletion src/Medidata.MAuth.Core/MAuthAuthenticator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
#if !NETSTANDARD1_4
using System.Net.Cache;
#endif
using System.Net.Http;
using System.Threading.Tasks;
using Org.BouncyCastle.Crypto;
@@ -66,10 +68,15 @@ private async Task<ApplicationInfo> GetApplicationInfo(Guid applicationUuid)
ApplicationUuid = options.ApplicationUuid,
PrivateKey = options.PrivateKey
},
innerHandler: options.MAuthServerHandler ?? new WebRequestHandler()
innerHandler: options.MAuthServerHandler ??
#if NETSTANDARD1_4
new HttpClientHandler()
#else
new WebRequestHandler()
{
CachePolicy = new RequestCachePolicy(RequestCacheLevel.Default)
}
#endif
);

using (var client = new HttpClient(signingHandler))
19 changes: 0 additions & 19 deletions src/Medidata.MAuth.Core/Medidata.MAuth.Core.nuspec

This file was deleted.

19 changes: 19 additions & 0 deletions src/Medidata.MAuth.Core/Medidata.MAuth.Core.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>c9a9fecb-db5b-40c3-b7cc-f0251853dde6</ProjectGuid>
<RootNamespace>Medidata.MAuth.Core</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
5 changes: 1 addition & 4 deletions src/Medidata.MAuth.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Medidata.MAuth.Core")]
[assembly: AssemblyDescription("Core library for Medidata HMAC protocol implementation.")]
[assembly: Guid("7e7795b5-2a8f-4d97-9a75-2518c78260e5")]
[assembly: InternalsVisibleTo("Medidata.MAuth.Owin")]
[assembly: InternalsVisibleTo("Medidata.MAuth.WebApi")]
5 changes: 0 additions & 5 deletions src/Medidata.MAuth.Core/packages.config

This file was deleted.

38 changes: 38 additions & 0 deletions src/Medidata.MAuth.Core/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"version": "2.1.0-*",
"title": "Medidata.MAuth.Core",
"authors": [ "Medidata Solutions, Inc." ],
"description": "A core package for Medidata HMAC protocol implementation. This package contains the core functionality which used by the MAuth authentication protocol-specific components. This package also can be used standalone if you want to sign HTTP/HTTPS requests with Medidata MAuth keys using the .NET HttpClient message handler mechanism.",
"copyright": "Copyright © Medidata Solutions, Inc. 2016",
"packOptions": {
"owners": [ "Medidata Solutions, Inc." ],
"requireLicenseAcceptance": true,
"projectUrl": "https://github.com/mdsol/mauth-client-dotnet",
"licenseUrl": "https://github.com/mdsol/mauth-client-dotnet/blob/master/LICENSE.md",
"summary": "A core package for Medidata HMAC protocol implementation. This package contains the core functionality which used by the MAuth authentication protocol-specific components. This package also can be used standalone if you want to sign HTTP/HTTPS requests with Medidata MAuth keys using the .NET HttpClient message handler mechanism.",
"releaseNotes": "This version introduces the MAuthSigningOptions options object instead of the MAuthOptions for the MAuthSigningHandler. With this change the handler does not need the MAuth server url for its configuration anymore.",
"tags": [ "medidata", "mauth", "hmac", "authentication", "core", "httpclient", "messagehandler" ]
},

"dependencies": {
"NETStandard.Library": "1.6.1",
"Newtonsoft.Json": "9.0.1"
},

"frameworks": {
"netstandard1.4": {
"imports": "dnxcore50",
"dependencies": {
"System.Net.Http": "4.3.0",
"Portable.BouncyCastle": "1.8.1.2"
}
},
"net452": {
"dependencies": {
"BouncyCastle": "1.8.1",
"Microsoft.Net.Http": "2.2.22",
"System.Net.Http": "4.0.0"
}
}
}
}
82 changes: 0 additions & 82 deletions src/Medidata.MAuth.Owin/Medidata.MAuth.Owin.csproj

This file was deleted.

19 changes: 0 additions & 19 deletions src/Medidata.MAuth.Owin/Medidata.MAuth.Owin.nuspec

This file was deleted.

19 changes: 19 additions & 0 deletions src/Medidata.MAuth.Owin/Medidata.MAuth.Owin.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>74308221-d7a5-4c15-86d2-62871655c24b</ProjectGuid>
<RootNamespace>Medidata.MAuth.Owin</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
5 changes: 0 additions & 5 deletions src/Medidata.MAuth.Owin/packages.config

This file was deleted.

30 changes: 30 additions & 0 deletions src/Medidata.MAuth.Owin/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "2.1.0-*",
"title": "Medidata.MAuth.Owin",
"description": "This package contains an OWIN middleware to validate signed http requests with the Medidata MAuth protocol. The middleware communicates with an MAuth server in order to confirm the validity of the request authentication header. Include this package in your OWIN-enabled web api if you want to authenticate the api requests signed with the MAuth protocol.",
"copyright": "Copyright © Medidata Solutions, Inc. 2016",
"authors": [ "Medidata Solutions, Inc." ],

"packOptions": {
"owners": [ "Medidata Solutions, Inc." ],
"requireLicenseAcceptance": true,
"projectUrl": "https://github.com/mdsol/mauth-client-dotnet",
"licenseUrl": "https://github.com/mdsol/mauth-client-dotnet/blob/master/LICENSE.md",
"summary": "An OWIN middleware for the core Medidata.MAuth module.",
"releaseNotes": "This version makes possible to read the OWIN request body in the subsequent middlewares after the authentication, even if the body stream is not seekable initially.",
"tags": [ "medidata", "mauth", "hmac", "authentication", "core", "owin", "middleware", "webapi" ]
},

"dependencies": {
"Medidata.MAuth.Core": "2.1.0-*"
},

"frameworks": {
"net452": {
"dependencies": {
"Owin": "1.0.0",
"Microsoft.Owin": "3.0.1"
}
}
}
}
6 changes: 3 additions & 3 deletions src/Medidata.MAuth.WebApi/MAuthAuthenticatingHandler.cs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ namespace Medidata.MAuth.WebApi
/// A HTTP message handler to authenticate in incoming <see cref="HttpRequestMessage"/> based on its MAuth-specific
/// authentication information.
/// </summary>
public class MAuthAuthenticatingHandler: DelegatingHandler
public class MAuthAuthenticatingHandler : DelegatingHandler
{
private readonly MAuthWebApiOptions options;
private readonly MAuthAuthenticator authenticator;
@@ -24,7 +24,7 @@ public class MAuthAuthenticatingHandler: DelegatingHandler
/// <see cref="MAuthWebApiOptions"/>.
/// </summary>
/// <param name="options">The options for this message handler.</param>
public MAuthAuthenticatingHandler(MAuthWebApiOptions options): this(options, new HttpClientHandler()) { }
public MAuthAuthenticatingHandler(MAuthWebApiOptions options) : this(options, new HttpClientHandler()) { }

/// <summary>
/// Initializes a new instance of the <see cref="MAuthAuthenticatingHandler"/> class with the provided
@@ -53,7 +53,7 @@ protected async override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request, CancellationToken cancellationToken)
{
if (!await request.TryAuthenticate(authenticator, options.HideExceptionsAndReturnForbidden))
return request.CreateResponse(HttpStatusCode.Forbidden);
return new HttpResponseMessage(HttpStatusCode.Forbidden) { RequestMessage = request };

return await base
.SendAsync(request, cancellationToken)
84 changes: 0 additions & 84 deletions src/Medidata.MAuth.WebApi/Medidata.MAuth.WebApi.csproj

This file was deleted.

19 changes: 0 additions & 19 deletions src/Medidata.MAuth.WebApi/Medidata.MAuth.WebApi.nuspec

This file was deleted.

19 changes: 19 additions & 0 deletions src/Medidata.MAuth.WebApi/Medidata.MAuth.WebApi.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>e557f648-6fe1-432e-a8d7-bd00c18e5176</ProjectGuid>
<RootNamespace>Medidata.MAuth.WebApi</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
11 changes: 0 additions & 11 deletions src/Medidata.MAuth.WebApi/app.config

This file was deleted.

6 changes: 0 additions & 6 deletions src/Medidata.MAuth.WebApi/packages.config

This file was deleted.

28 changes: 28 additions & 0 deletions src/Medidata.MAuth.WebApi/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "2.1.0-*",
"title": "Medidata.MAuth.WebApi",
"description": "This package contains an HTTP message handler to validate signed http requests with the Medidata MAuth protocol. The handler communicates with an MAuth server in order to confirm the validity of the request authentication header. Include this package in your WebAPI application if you want to authenticate the api requests signed with the MAuth protocol.",
"copyright": "Copyright © Medidata Solutions, Inc. 2016",
"authors": [ "Medidata Solutions, Inc." ],

"packOptions": {
"owners": [ "Medidata Solutions, Inc." ],
"requireLicenseAcceptance": true,
"projectUrl": "https://github.com/mdsol/mauth-client-dotnet",
"licenseUrl": "https://github.com/mdsol/mauth-client-dotnet/blob/master/LICENSE.md",
"summary": "An HTTP message handler for the core Medidata.MAuth module.",
"releaseNotes": "No major changes in this version of the WebAPI package this time.",
"tags": [ "medidata", "mauth", "hmac", "authentication", "core", "webapi", "message", "handler" ]
},

"dependencies": {
"Medidata.MAuth.Core": "2.1.0-*"
},

"frameworks": {
"net452": {
"dependencies": {
}
}
}
}
13 changes: 5 additions & 8 deletions tests/Medidata.MAuth.Tests/Handlers/MAuthServerHandler.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using Medidata.MAuth.Core;
using Newtonsoft.Json;
using System;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
using Medidata.MAuth.Core;
using Newtonsoft.Json;

namespace Medidata.MAuth.Tests
{
@@ -20,18 +19,16 @@ protected override async Task<HttpResponseMessage> SendAsync(
{
var authInfo = request.GetAuthenticationInfo();

request.SetConfiguration(new HttpConfiguration());

if (!await authInfo.Payload.Verify(
await request.GetSignature(authInfo),
TestExtensions.ServerPublicKey
))
return request.CreateResponse(HttpStatusCode.Forbidden);
return new HttpResponseMessage(HttpStatusCode.Forbidden) { RequestMessage = request };

if (!request.RequestUri.AbsolutePath.Equals(
$"{Constants.MAuthTokenRequestPath}{clientUuid.ToHyphenString()}.json",
StringComparison.OrdinalIgnoreCase))
return request.CreateResponse(HttpStatusCode.NotFound);
return new HttpResponseMessage(HttpStatusCode.NotFound) { RequestMessage = request };

return new HttpResponseMessage(HttpStatusCode.OK)
{
186 changes: 0 additions & 186 deletions tests/Medidata.MAuth.Tests/Medidata.MAuth.Tests.csproj

This file was deleted.

22 changes: 22 additions & 0 deletions tests/Medidata.MAuth.Tests/Medidata.MAuth.Tests.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>a1940d71-52b3-42ec-b2df-70782afff23c</ProjectGuid>
<RootNamespace>Medidata.MAuth.Tests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
5 changes: 1 addition & 4 deletions tests/Medidata.MAuth.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Medidata.MAuth.Tests")]
[assembly: AssemblyDescription("Assembly which contains unit tests of the Medidata.MAuth framework.")]
[assembly: Guid("0c3cf95c-15c7-431a-b6a0-ec591240e315")]
2 changes: 1 addition & 1 deletion tests/Medidata.MAuth.Tests/TestExtensions.cs
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ internal static class TestExtensions

public static Task<string> GetStringFromResource(string resourceName)
{
var assembly = Assembly.GetExecutingAssembly();
var assembly = typeof(TestExtensions).GetTypeInfo().Assembly;

using (var stream = assembly.GetManifestResourceStream(resourceName))
using (var reader = new StreamReader(stream))
14 changes: 0 additions & 14 deletions tests/Medidata.MAuth.Tests/app.config

This file was deleted.

20 changes: 0 additions & 20 deletions tests/Medidata.MAuth.Tests/packages.config

This file was deleted.

43 changes: 43 additions & 0 deletions tests/Medidata.MAuth.Tests/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": "2.1.0-*",
"title": "Medidata.MAuth.Tests",
"authors": [ "Medidata Solutions, Inc." ],
"description": "Assembly which contains unit tests of the Medidata.MAuth framework.",
"copyright": "Copyright © Medidata Solutions, Inc. 2016",

"testRunner": "xunit",

"buildOptions": {
"embed": [
"Mocks/Keys/*.*",
"Mocks/Requests/*.*"
],
"copyToOutput": {
"include": [ "xunit.runner.json" ]
}
},

"dependencies": {
"xunit": "2.2.0-beta4-build3444",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"Medidata.MAuth.Core": {
"target": "project"
},
"Microsoft.Owin.Hosting": "3.0.1",
"Microsoft.Owin.Testing": "3.0.1",
"Microsoft.Owin.Host.HttpListener": "3.0.1"
},

"frameworks": {
"net452": {
"dependencies": {
"Medidata.MAuth.Owin": {
"target": "project"
},
"Medidata.MAuth.WebApi": {
"target": "project"
}
}
}
}
}
3 changes: 3 additions & 0 deletions tests/Medidata.MAuth.Tests/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"methodDisplay": "method"
}

0 comments on commit 5224b6b

Please sign in to comment.