Revoke.NET.AspNetCore 2.0.0

.NET Standard 2.1
dotnet add package Revoke.NET.AspNetCore --version 2.0.0
NuGet\Install-Package Revoke.NET.AspNetCore -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Revoke.NET.AspNetCore" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Revoke.NET.AspNetCore --version 2.0.0
#r "nuget: Revoke.NET.AspNetCore, 2.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Revoke.NET.AspNetCore as a Cake Addin
#addin nuget:?package=Revoke.NET.AspNetCore&version=2.0.0

// Install Revoke.NET.AspNetCore as a Cake Tool
#tool nuget:?package=Revoke.NET.AspNetCore&version=2.0.0

Revoke.NET ASP.NET Core Extension

MongoDB BlackList Store Extension for [Revoke.NET] (https://www.nuget.org/packages/Revoke.NET)

Installation

Install the Revoke.NET.AspNetCore NuGet package into your app

PM> Install-Package Revoke.NET.AspNetCore

Usage with ASP.NET Core

using Revoke.NET;
using Revoke.NET.AspNetCore;

var builder = WebApplication.CreateBuilder(args);

builder.Services
    .AddRevokeStore(() => /*  provide a BlackList Store */)
    .AddHttpContextRevokeMiddleware(
        context => { /* create custom key selector from HttpContext */ },
        response => { /* create a custom response to be sent when a request is revoked */  }
    ); 

JWT Bearer Token Example

using System.Net.Http.Headers;
using Microsoft.AspNetCore.Mvc;
using Revoke.NET;
using Revoke.NET.AspNetCore;

var builder = WebApplication.CreateBuilder(args);

builder.Services
    .AddRevokeInMemoryStore() // Register a Revoke Store
    .AddJWTBearerTokenRevokeMiddleware(); // Register a Revoke Middleware

var app = builder.Build();

app.UseRevoke(); // Use Middleware before calling UseAuthorization()

app.UseAuthorization();
app.UseAuthentication();

app.MapGet("/logout", async ([FromServices] IBlackListStore store, HttpRequest request) =>
{
    var token = AuthenticationHeaderValue.Parse(request.Headers.Authorization).Parameter;

    await store.Revoke(token);

    return true;
});

app.Run();
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 145,207 8/5/2022
1.0.7 134,700 5/25/2022
1.0.6 16,480 5/17/2022
1.0.5 36,424 5/11/2022
1.0.4 15,878 5/8/2022
1.0.3 171 5/8/2022