CSTP.UserAuthenticator 1.4.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package CSTP.UserAuthenticator --version 1.4.1                
NuGet\Install-Package CSTP.UserAuthenticator -Version 1.4.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="CSTP.UserAuthenticator" Version="1.4.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSTP.UserAuthenticator --version 1.4.1                
#r "nuget: CSTP.UserAuthenticator, 1.4.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.
// Install CSTP.UserAuthenticator as a Cake Addin
#addin nuget:?package=CSTP.UserAuthenticator&version=1.4.1

// Install CSTP.UserAuthenticator as a Cake Tool
#tool nuget:?package=CSTP.UserAuthenticator&version=1.4.1                

Logo

CSTP User Authenticator

CSTP User Authentication is a secure and reliable nuget package designed and developed by ( Central Securities Clearing System Plc ) engineers to manage user authentication processes within their CSTP eco system.

Features

- User Authentication on CSTP.
- Configuaration helper.

Installation

To install run the folowing command in the nuget manager console with the target project selected

 1. nuget install CSTP.UserAuthenticator.
 2. Goto your program file and add the following code: 
 
ConfigurationHelper.InstantaiteConfiguration(builder.Configuration);

OR

 1. Right click on the target project.
 2. Select manage nuget packages.
 3. Search for "CSTP.UserAuthenticator" (without the quote).
 4. Click Install and follow the prompt.
 5. Goto your program file and add the following code: 
 
ConfigurationHelper.InstantaiteConfiguration(builder.Configuration);

Usage/Examples

authorization
Add the attribute [CSTPAuthorizationAttribute] on any endpoint your want to authenticate.
Note:the endpoint must have been enlisted on CSCS CSTP
Getting Authentication response in controller
To get the response from the validation use the below code in the protected action 

HttpContext.Session.GetObjectFromJson<ApiUserValidationResponse>("ActionName");

below is the response object gotten form Session

    public class ApiUserValidationResponse
    {
        public string ResponseCode { get; set; }
        public string Message { get; set; }
        public string token_type { get; set; }
        public string userName { get; set; }
        public string expires_in { get; set; }
        public string ext_expires_in { get; set; }
        public string access_token { get; set; }
        public RightsPrivilagesResponseDTO? Privilages { get; set;}
    }

    public class RightsPrivilagesResponseDTO
    {
        public List<RightsPrivilages>? RightsAccess { get; set; }
        public string? ResponseCode { get; set; }
        public string? Message { get; set; }
    }

    public class RightsPrivilages
    {
        public string? GroupName { get; set; }
        public string? SGroupName { get; set; }
        public string? RightObjects { get; set; }
        public Guid? ProductUID { get; set; }
    }
Using Configuration helper to get section from app settings.
This is just an added function. When getting a section of your appsetting.json you can utilize 
the Configuaration helper that come with the nuget package as shown below:

ConfigurationHelper.GetAppSettingSectionSingleProperty("SectionName:PropertyName");

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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. 
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
1.5.0 118 5/12/2024
1.4.5 109 5/12/2024
1.4.4 100 5/12/2024
1.4.3 99 5/12/2024
1.4.2 86 5/12/2024
1.4.1 125 4/9/2024
1.4.0 132 4/8/2024
1.3.9 118 4/7/2024
1.3.8 122 4/7/2024
1.3.7 108 4/7/2024
1.3.6 113 4/7/2024
1.3.5 105 4/7/2024
1.3.4 107 4/7/2024
1.3.3 119 4/7/2024
1.3.2 122 4/7/2024
1.3.1 125 4/7/2024
1.3.0 107 4/7/2024
1.0.4 139 4/7/2024
1.0.2 111 4/7/2024
1.0.1 127 3/25/2024
1.0.0 124 3/25/2024

Version one. testing