SuperOffice.SystemUser.Client 1.0.1 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved

.NET Standard 2.0
Install-Package SuperOffice.SystemUser.Client -Version 1.0.1
dotnet add package SuperOffice.SystemUser.Client --version 1.0.1
<PackageReference Include="SuperOffice.SystemUser.Client" Version="1.0.1" />
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.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SuperOffice.SystemUser.Client, 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 SuperOffice.SystemUser.Client as a Cake Addin
#addin nuget:?package=SuperOffice.SystemUser.Client&version=1.0.1

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

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, QAStage, 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.WebApi.IdentityModel 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
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
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 NuGet.org.

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.1 264 4/29/2022
1.0.0 73 4/28/2022