-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jérôme Quiles
committed
Aug 30, 2017
1 parent
5e42918
commit 32dc79d
Showing
26 changed files
with
180 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NUnit" version="3.7.1" targetFramework="net461" /> | ||
<package id="NUnit" version="3.8.1" targetFramework="net461" /> | ||
<package id="NUnit3TestAdapter" version="3.8.0" targetFramework="net461" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="NUnit" version="3.7.1" targetFramework="net461" /> | ||
<package id="NUnit" version="3.8.1" targetFramework="net461" /> | ||
<package id="NUnit3TestAdapter" version="3.8.0" targetFramework="net461" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Microsoft.Owin; | ||
using Skeleton.Core; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Skeleton.Web.Server.Configuration | ||
{ | ||
public sealed class RequestIdMiddleware: OwinMiddleware | ||
{ | ||
public RequestIdMiddleware(OwinMiddleware next ): base(next) | ||
{ | ||
} | ||
|
||
public override async Task Invoke(IOwinContext context) | ||
{ | ||
var requestId = context.GetRequestId(); | ||
|
||
if (requestId.IsNotNullOrEmpty()) | ||
context.SetRequestId(requestId); | ||
|
||
await Next.Invoke(context); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
using Microsoft.Owin; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Skeleton.Web.Server.Configuration | ||
{ | ||
public class RequireSslMiddleware | ||
public sealed class RequireSslMiddleware: OwinMiddleware | ||
{ | ||
private readonly Func<IDictionary<string, object>, Task> _next; | ||
private readonly OwinMiddleware _next; | ||
|
||
public RequireSslMiddleware(Func<IDictionary<string, object>, Task> next) | ||
{ | ||
_next = next; | ||
public RequireSslMiddleware(OwinMiddleware next) | ||
: base(next) | ||
{ | ||
} | ||
|
||
public async Task Invoke(IDictionary<string, object> env) | ||
public override async Task Invoke(IOwinContext context) | ||
{ | ||
var context = new OwinContext(env); | ||
|
||
if (context.Request.Uri.Scheme != Uri.UriSchemeHttps) | ||
{ | ||
context.Response.StatusCode = 403; | ||
context.Response.ReasonPhrase = "SSL is required."; | ||
|
||
await context.Response.WriteAsync(context.Response.ReasonPhrase); | ||
|
||
return; | ||
} | ||
|
||
await _next(env); | ||
await Next.Invoke(context); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.