SuperOffice.SystemUser.Client 1.0.4

The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved
.NET Standard 2.0
dotnet add package SuperOffice.SystemUser.Client --version 1.0.4
NuGet\Install-Package SuperOffice.SystemUser.Client -Version 1.0.4
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="SuperOffice.SystemUser.Client" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SuperOffice.SystemUser.Client --version 1.0.4
#r "nuget: SuperOffice.SystemUser.Client, 1.0.4"
#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 SuperOffice.SystemUser.Client as a Cake Addin
#addin nuget:?package=SuperOffice.SystemUser.Client&version=1.0.4

// Install SuperOffice.SystemUser.Client as a Cake Tool
#tool nuget:?package=SuperOffice.SystemUser.Client&version=1.0.4

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.

  1. Use the ValidateSystemUserResultMethod, and get back a TokenValidationResult. This method is responsible for populating SystemUserClient.ClaimsIdentity property. This method is also used by the GetSystemUserTicketAsync method.
var tokenValidationResult = await sysUserClient.ValidateSystemUserResultAsync(systemUserResult);
  1. Manually perform validation and extract claims, the SystemUserClient uses the JwtTokenHandler, located in the SuperOffice.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 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-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. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SuperOffice.SystemUser.Client:

Package Downloads
SuperOffice.WebApi.Authorization.SystemUserTicket The ID prefix of this package has been reserved for one of the owners of this package by

System User Ticket Authorization for SuperOffice.WebApi.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 555 4/27/2023
1.0.3 6,850 10/24/2022
1.0.2 372 9/7/2022
1.0.1 14,516 4/29/2022
1.0.0 387 4/28/2022

Changed SubDomain validation to only check subdomain begins with sod, qaonline or online.