CSTP.UserAuthenticator 1.5.0

dotnet add package CSTP.UserAuthenticator --version 1.5.0
NuGet\Install-Package CSTP.UserAuthenticator -Version 1.5.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="CSTP.UserAuthenticator" Version="1.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSTP.UserAuthenticator --version 1.5.0
#r "nuget: CSTP.UserAuthenticator, 1.5.0"
#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.5.0

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

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 our CSTP eco system.

Features

- User Authentication on CSTP.
- HttpContext Extension

Installation

 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.

OR

Run the following command in the nuget manager console with the target project selected

 1. nuget install CSTP.UserAuthenticator.

Usage/Examples

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

var yourVariableName = HttpContext.GetObject(HttpContext.Request.Headers["accessToken"]);

below is the sample response object that will be returned from the above method call

    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; }
    }

HTTPContext Extenstion
As an additional feature you can utilize the HTTPContext extension written to set or get an already 
set to the HTTPContext

- HttpContext.SetObject(string key, object item); //To set an item.
- HttpContext.GetObject(string key) //To get already set item.

License

[MIT](https://choosealicense.com/licenses/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 81 5/12/2024
1.4.5 80 5/12/2024
1.4.4 71 5/12/2024
1.4.3 72 5/12/2024
1.4.2 70 5/12/2024
1.4.1 112 4/9/2024
1.4.0 101 4/8/2024
1.3.9 99 4/7/2024
1.3.8 98 4/7/2024
1.3.7 81 4/7/2024
1.3.6 82 4/7/2024
1.3.5 75 4/7/2024
1.3.4 92 4/7/2024
1.3.3 86 4/7/2024
1.3.2 92 4/7/2024
1.3.1 96 4/7/2024
1.3.0 83 4/7/2024
1.0.4 107 4/7/2024
1.0.2 98 4/7/2024
1.0.1 102 3/25/2024
1.0.0 106 3/25/2024

First Release