MicroServiceAuthenticator 1.0.1
dotnet add package MicroServiceAuthenticator --version 1.0.1
NuGet\Install-Package MicroServiceAuthenticator -Version 1.0.1
<PackageReference Include="MicroServiceAuthenticator" Version="1.0.1" />
<PackageVersion Include="MicroServiceAuthenticator" Version="1.0.1" />
<PackageReference Include="MicroServiceAuthenticator" />
paket add MicroServiceAuthenticator --version 1.0.1
#r "nuget: MicroServiceAuthenticator, 1.0.1"
#:package MicroServiceAuthenticator@1.0.1
#addin nuget:?package=MicroServiceAuthenticator&version=1.0.1
#tool nuget:?package=MicroServiceAuthenticator&version=1.0.1
MicroserviceAuthenticator
This is a nuget package built in ASP.NET Core to help quickly setup authentication up and running on your Web api app and also secure microservices. It's built on jwtBearer library.
Installation
MicroServiceAuthenticator can be installed via the nuget UI (as MicroServiceAuthenticator), or via the nuget package manager console:
PM> Install-Package MicroServiceAuthenticator
Dependencies
PM> Install-Package Microsoft.AspNetCore.Authentication.JwtBearer -Version 3.1.2
Configuring Settings
{
"TokenAuthentication": {
"SecretKey": "secret-key",
"Issuer": "issuer-app",
"Audience": "audience-key",
"ExpirationTime":300
}
}
Usage
After updating the application settings, open the Startup.cs file. Startup class is the heart of ASP.NET Core application’s configuration. First we need to import the MicroServiceAuthenticator
namespace.
The most important type in this library is the just adding it to the services configure pipline. Which can be added as shown below:
public ConfigureServices(IServiceCollection services)
{
services.AddMicroServiceAuthenticator(new TokenProviderOptions
{
Issuer = configuration["TokenAuthentication:Issuer"],
Audience = configuration["TokenAuthentication:Audience"],
SecretKey = configuration["TokenAuthentication:SecretKey"],
ExpirationTime = configuration["TokenAuthentication:ExpirationTime"]
});
}
Testing
Place the [Authorize]
attribute on the controller you want to authenticate and use the identity service to get your token and set the token to the authorization of the api endpoint and boom you are authenticated successfully.
Contribution
Feel free to send a PR.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
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 |
---|