Abenity.Members 1.0.1

There is a newer version of this package available.
See the version list below for details.
Install-Package Abenity.Members -Version 1.0.1
dotnet add package Abenity.Members --version 1.0.1
<PackageReference Include="Abenity.Members" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Abenity.Members --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Abenity.Members, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Abenity.Members as a Cake Addin
#addin nuget:?package=Abenity.Members&version=1.0.1

// Install Abenity.Members as a Cake Tool
#tool nuget:?package=Abenity.Members&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Abenity.Members Version Downloads Build Status

.NET Standard API Client for interacting with the Abenity Members API This is offered as an alternative to the office abenity-csharp library with some enhancements.

Configuration

The following information is required to authenticate SSO requests.

  1. API credentials. Specifically: username, password and key. You get these values from Abenity.
  2. A public and private key. You need to generate these, and send your public key to Abenity to associate with your account.

Provided below is an example configuration section. Note that the key entries are paths to files containing the key information, not the keys themselves.

"Abenity": {
    "UseProduction": false,
    "KeyPaths": {
        "PrivateKeyFilePath": "./keys/private.pem",
        "PublicKeyFilePath": "./keys/public.pem"
    },
    "Credentials": {
        "Username": "abcd",
        "Password": "abcde12345^&*",
        "Key": "abcdef"
    }
}

Note that the keys are required to be in the PKCS1 format

Example Usage

Register the API Client in your application's service provider

var config = new AbenityConfiguration();
Configuration.Bind("Abenity", config);
services.AddSingleton(config);

services.AddHttpClient();
services.AddScoped<IAbenityMembersApiClient, AbenityMembersApiClient>();

Inject it into your service/controller and make a call

private readonly IAbenityMembersApiClient membersClient;

public MyService(IAbenityMembersApiClient membersClient) {
    this.membersClient = membersClient;
}

public async Task<IActionResult> GoToAbenity() {
    var userInfo = myUserInfoService.GetCurrentUserInfo().ToAbenityRequest();
    var result = await membersClient.AuthenticateUserAsync(userInfo);
    return Redirect(result.Url);
}

Comparison with abenity-csharp

This libary is based on the official package provided by Abenity and shares most of its authentication code with that library, but offers several key improvements:

  • Fuller Endpoint Support - The official library only supports SSO authentication calls. In this library, methods for calling the deauthorize and reauthorize user endpoints are also provided.
  • Typed Responses - The official library just spits out a string as a response to SSO authentication requests and it's up to you to parse them. This library, by contrast, will provide a typed object for you to access. If something goes wrong, you get a typed exception with the details populated based on the response from the API, removing some of the guesswork. This is handled by Json.NET using stream deserialization after header transfer for optimal performance.
  • Out-of-the-box Dependency Injection Support - Configuration is bundled into a single object for easy injection and the API client can accept an HttpClient from an IHttpClientFactory for optimal efficiency
  • Better File Handling - The official library opens the key files at construction and never explicitly closes them. In this library, file reads are correctly scoped so they are only open for a minimal amount of time.
  • Enhanced Documentation - XML Comments are provided on public-facing models and methods to help guide usage.

Dependencies

  • BouncyCastle 1.8.5+
  • Newtonsoft.Json 10.0.3+
  • System.ComponentModel.Annotations 4.7.0+

Changelog

1.0.0 Initial Release

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.0.2 91 2/12/2021
1.0.1 78 2/11/2021
1.0.0 308 3/31/2020

Improve error logging