dotnet add package SuperOffice.SystemUser.Client --version 1.0.4
NuGet\Install-Package SuperOffice.SystemUser.Client -Version 1.0.4
<PackageReference Include="SuperOffice.SystemUser.Client" Version="1.0.4" />
paket add SuperOffice.SystemUser.Client --version 1.0.4
#r "nuget: SuperOffice.SystemUser.Client, 1.0.4"
// 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
The constructor accepts a
SuperOffice.SystemUser.SystemUserInfo instance, and contains all of the information required to submit a request to the partnersystemuserservice.svc endpoint.
|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
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 the
var tokenValidationResult = await sysUserClient.ValidateSystemUserResultAsync(systemUserResult);
- Manually perform validation and extract claims, the
JwtTokenHandler, located in the
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);
SystemUserTokenHandler.ValidateAsync returns a TokenValidationResult, a Microsoft datatype located in the Microsoft.IdentityModel.Tokens namespace, in the
|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-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.|
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SuperOffice.SystemUser.Client:
System User Ticket Authorization for SuperOffice.WebApi.
This package is not used by any popular GitHub repositories.
Changed SubDomain validation to only check subdomain begins with sod, qaonline or online.