Skip to content

Mindfor/AspNetCore.Pipeline

Repository files navigation

Pipeline middlewares for ASP.NET Core

Build status

Repo contains middlewares for:

  • Basic authentication;
  • Require only HTTP or HTTPS requests.

Installation

Dev branch is build for ASP.NET Core 1.0.0-RC2 (https://www.myget.org/gallery/aspnetvnext). We have published NuGet package to the custom Mindfor MyGet source because ASP.NET Core RC2 is not yet ready. So you should add this source to the project NuGet.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<packageSources>
		<clear/>
		<add key="AspNetVNext" value="https://www.myget.org/F/aspnetvnext/api/v3/index.json" />
		<add key="Mindfor" value="https://www.myget.org/F/mindfor/api/v3/index.json" />
		<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
	</packageSources>
</configuration>

The just install NuGet package:

Install-Package Mindfor.AspNetCore.Pipeline -Pre

We will publish package to the NuGet.org when there will be final RC2.

How to use

Basic authentication

Basic authentication requires ASP.NET Core Identity. Add Identity services and basic authentication to the pipeline in Startup class:

public void ConfigureServices(IServiceCollection services)
{
	services.AddIdentity<MyUserType, MyRoleType>();
}

public void Configure(IApplicationBuilder app)
{
	app.UseBasicAuthentication<MyUserType>();
}

Require only HTTP/HTTPS requests

Add one of middlewares to the pipeline in Startup class to redirect all requests to HTTP or HTTPS:

public void Configure(IApplicationBuilder app)
{
	app.UseRequireHttps(); // redirect all requests to HTTPS
	app.UseRequireHttp(); // or redirect all requests to HTTP
	// register other middlewares
}

Licence

Code by Alexander Fomin. Copyright 2016 Mindfor Ltd.

This package has MIT license. Refer to the LICENSE for detailed information.

About

Additional pipeline middlewares for ASP.NET Core

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published