NetPro.Authentication 6.0.14

There is a newer version of this package available.
See the version list below for details.
dotnet add package NetPro.Authentication --version 6.0.14                
NuGet\Install-Package NetPro.Authentication -Version 6.0.14                
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="NetPro.Authentication" Version="6.0.14" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetPro.Authentication --version 6.0.14                
#r "nuget: NetPro.Authentication, 6.0.14"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetPro.Authentication as a Cake Addin
#addin nuget:?package=NetPro.Authentication&version=6.0.14

// Install NetPro.Authentication as a Cake Tool
#tool nuget:?package=NetPro.Authentication&version=6.0.14                

Authentication使用

NuGet

对Microsoft.AspNetCore.Authentication认证组件的封装,简化使用

使用

appsetting.json
"AuthenticationOption": {
  "Enabled": true,
  "Secret": "6666666666666666", //最少配置16位
  "Issuer": "NetPro.com",
  "AccessTokenExpired": 6, //单位小时
  "RefreshTokenExpired": 168 //单位小时
}

启用服务
public void ConfigureServices(IServiceCollection services)
{
      services.AddNetProAuthentication(configuration);
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
     app.UseNetProAuthentication();
}

如增加了以下环境变量配置,可省略以上初始化代码,内部将自动执行以上初始化

 "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "NetPro.Startup"

使用说明

[Authorize]
/// <summary>
/// 方法或者类加[Authorize]特性,此接口或者此控制器将启用JWT认证才可访问,具体参考示例
/// </summary>
public void Method()

[AllowAnonymous]
/// <summary>
/// 方法或者类加[Authorize]特性,此接口或者此控制器将强制匿名访问,具体参考示例
/// </summary>
public void Method()

备注

如认证接口数量大于匿名接口数量,建议接口全局默认认证访问,可省去频繁[Authorize]

 app.UseEndpoints(endpoints =>
      {
          endpoints.MapControllers().RequireAuthorization();
      });

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NetPro.Authentication:

Package Downloads
NetPro.Web.Core

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.0.16 212 7/24/2023
6.0.15 435 7/19/2022
6.0.14 454 7/10/2022
6.0.13 416 6/15/2022
6.0.12 434 6/15/2022
6.0.11 438 6/15/2022
6.0.10 441 6/11/2022
6.0.9 439 6/8/2022
6.0.8 420 5/26/2022
6.0.8-beta.3 121 5/24/2022
6.0.8-beta.2 120 5/24/2022
6.0.7 442 5/18/2022
6.0.6 460 4/28/2022
6.0.5 440 3/30/2022
6.0.5-beta.20 112 4/27/2022
6.0.5-beta.19 121 4/25/2022
6.0.5-beta.18 116 4/22/2022
6.0.5-beta.17 131 4/16/2022
6.0.5-beta.16 128 4/8/2022
6.0.5-beta.15 130 4/8/2022
6.0.5-beta.14 134 4/7/2022
6.0.5-beta.13 130 4/7/2022
6.0.5-beta.12 128 4/6/2022
6.0.5-beta.11 129 4/6/2022
6.0.5-beta.10 136 3/31/2022
6.0.5-beta.9 140 3/26/2022
6.0.5-beta.8 133 3/22/2022
6.0.5-beta.7 122 3/21/2022
6.0.5-beta.6 125 3/14/2022
6.0.5-beta.5 124 3/2/2022
6.0.5-beta.4 128 2/22/2022
6.0.5-beta.3 129 2/18/2022
6.0.5-beta.2 126 2/18/2022
6.0.5-beta.1 127 2/16/2022
6.0.4 436 2/10/2022
6.0.3 428 2/9/2022
6.0.3-beta.9 125 2/10/2022
6.0.3-beta.7 143 1/27/2022
6.0.3-beta.6 134 1/19/2022
6.0.3-beta.5 129 1/17/2022
6.0.3-beta.4 135 1/16/2022
6.0.3-beta.3 132 1/14/2022
6.0.3-beta.2 136 1/13/2022
6.0.3-beta.1 161 1/11/2022
6.0.2 361 1/6/2022
6.0.1 1,008 12/3/2021
3.1.11 474 11/19/2021 3.1.11 is deprecated because it has critical bugs.
3.1.10 1,823 7/29/2021
3.1.9 1,603 7/1/2021
3.1.8 1,678 12/15/2020
3.1.6 2,967 9/16/2020