SuperOffice.SystemUser.Client
1.0.5
Prefix Reserved
See the version list below for details.
dotnet add package SuperOffice.SystemUser.Client --version 1.0.5
NuGet\Install-Package SuperOffice.SystemUser.Client -Version 1.0.5
<PackageReference Include="SuperOffice.SystemUser.Client" Version="1.0.5" />
paket add SuperOffice.SystemUser.Client --version 1.0.5
#r "nuget: SuperOffice.SystemUser.Client, 1.0.5"
// Install SuperOffice.SystemUser.Client as a Cake Addin #addin nuget:?package=SuperOffice.SystemUser.Client&version=1.0.5 // Install SuperOffice.SystemUser.Client as a Cake Tool #tool nuget:?package=SuperOffice.SystemUser.Client&version=1.0.5
SuperOffice SystemUser Client
This library supports the System User flow. The client makes it very easy to call the online PartnerSystemUserService endpoint, validate the JWT and return the claims it contains.
The JWT contains a lot of information, however, it's usually just the Ticket credential that is interesting. Therefore, SuperOffice.SystemUser.Client simplifies calling the service, validating the response, and then returning the ticket in a single method call.
[!WARNING] Do not ask for a System User Ticket every single time you SuperOffice web services - they are good for 6 hours. When you get a ticket, a new credentials record in the database each and every time. Therefore, take advantage of the 6 hour window and only ask for a new Ticket when absolutely necessary!
How to use System User flow
Use the SystemUserClient class, located in the SuperOffice.SystemUser
namespace.
The constructor accepts a SuperOffice.SystemUser.SystemUserInfo
instance, and contains all of the information required to submit a request to the partnersystemuserservice.svc endpoint.
SystemUserInfo Properties
Property | Description |
---|---|
SubDomain | The online environment (SOD, QAOnline, Production). |
ContextIdentifier | The tenant, or customer, identity. |
ClientSecret | The application secret, a.k.a. client_secret. |
PrivateKey | The applications RSAXML private certificate value. |
SystemUserToken | The SystemUser token, issued during app approval. |
Given the required information, the SystemUserClient
is able to generate and send a request to the service, then receive and validate the response.
var sysUserClient = new SystemUserClient(systemUserInfo);
var sysUserJwt = await sysUserClient.GetSystemUserJwtAsync();
var sysUserTkt = await sysUserClient.GetSystemUserTicketAsync();
GetSystemUserJwtAsync, only returns the JWT, wrapped in a SystemUserResult
. It does not validate or extract any claims.
GetSystemUserTicketAsync, obtains the JWT, validates the token, and returns the system user ticket.
Explicit JWT validation
When using GetSystemUserJwtAsync
, there are two ways you can perform validation.
- Use the ValidateSystemUserResultMethod, and get back a
TokenValidationResult
. This method is responsible for populating SystemUserClient.ClaimsIdentity property. This method is also used by theGetSystemUserTicketAsync
method.
var tokenValidationResult = await sysUserClient.ValidateSystemUserResultAsync(systemUserResult);
- Manually perform validation and extract claims, the
SystemUserClient
uses theJwtTokenHandler
, located in theSuperOffice.SystemUser.Tokens
namespace.
var handler = new SystemUserTokenHandler(
new System.Net.Http.HttpClient(), // HttpClient instance.
"sod" // target online environment (SOD, Stage or Production)
);
var tokenValidationResult = await handler.ValidateAsync(sysUserJwt.Token);
The method SystemUserTokenHandler.ValidateAsync
returns a TokenValidationResult, a Microsoft datatype located in the Microsoft.IdentityModel.Tokens namespace, in the Microsoft.IdentityModel.Tokens
assembly.
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
- Microsoft.Extensions.Caching.Memory (>= 6.0.1)
- Microsoft.IdentityModel.JsonWebTokens (>= 6.35.0)
- Microsoft.IdentityModel.Tokens (>= 6.35.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SuperOffice.SystemUser.Client:
Package | Downloads |
---|---|
SuperOffice.WebApi.Authorization.SystemUserTicket
System User Ticket Authorization for SuperOffice.WebApi. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Aligned package references with SuperOffice.WebApi.