MicroServiceAuthenticator 1.0.1

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MicroServiceAuthenticator --version 1.0.1
                    
NuGet\Install-Package MicroServiceAuthenticator -Version 1.0.1
                    
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="MicroServiceAuthenticator" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MicroServiceAuthenticator" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MicroServiceAuthenticator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MicroServiceAuthenticator --version 1.0.1
                    
#r "nuget: MicroServiceAuthenticator, 1.0.1"
                    
#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.
#:package MicroServiceAuthenticator@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MicroServiceAuthenticator&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MicroServiceAuthenticator&version=1.0.1
                    
Install as a Cake Tool

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.

.NET Core Nuget Nuget

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
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