Abenity.Members
1.0.1
See the version list below for details.
dotnet add package Abenity.Members --version 1.0.1
NuGet\Install-Package Abenity.Members -Version 1.0.1
<PackageReference Include="Abenity.Members" Version="1.0.1" />
paket add Abenity.Members --version 1.0.1
#r "nuget: Abenity.Members, 1.0.1"
// 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
Abenity.Members
.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.
- API credentials. Specifically: username, password and key. You get these values from Abenity.
- 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
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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- BouncyCastle (>= 1.8.5)
- Newtonsoft.Json (>= 10.0.3)
- System.ComponentModel.Annotations (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Improve error logging