Trimble.ID
Trimble.ID
Contents
- AccessToken
- AuthorizationCodeGrantTokenProvider
- #ctor(endpointProvider,clientId,redirectUrl,productName)
- #ctor(endpointProvider,clientId,redirectUri,productName)
- State
- GetOAuthLogoutRedirect(state)
- GetOAuthRedirect(state,prompt)
- ValidateCode(code)
- ValidateQuery(query)
- WithIdentityProvider(identityProvider)
- WithLogoutRedirect(logoutRedirectUrl)
- WithLogoutRedirect(logoutRedirectUri)
- WithScopes(scopes)
- AuthorizationFailedException
- BearerTokenHttpClientProvider
- ClientCredentialTokenProvider
- DeviceAuthorizationResponse
- DeviceAuthorizationStatus
- DeviceAuthorizationTokenProvider
- DeviceTokenErrorResponse
- EncryptedStorage
- ErrorMessage
- FixedEndpointProvider
- #ctor(productName)
- #ctor()
- #ctor(authorizationEndpoint,tokenEndpoint,userInfoEndpoint,tokenRevocationEndpoint,jwksEndpoint,endSessionEndpoint,deviceAuthorizationEndpoint)
- RetrieveAuthorizationEndpoint()
- RetrieveDeviceAuthorizationEndpoint()
- RetrieveEndSessionEndpoint()
- RetrieveJSONWebKeySetEndpoint()
- RetrieveTokenEndpoint()
- RetrieveTokenRevocationEndpoint()
- RetrieveUserInfoEndpoint()
- WithAuthorizationEndpoint(authorizationEndpoint)
- WithDeviceAuthorizationEndpoint(deviceAuthorizationEndpoint)
- WithEndSessionEndpoint(endSessionEndpoint)
- WithJWKSEndpoint(jwksEndpoint)
- WithTokenEndpoint(tokenEndpoint)
- WithTokenRevocationEndpoint(tokenRevocationEndpoint)
- WithUserInfoEndpoint(userInfoEndpoint)
- FixedKeySetProvider
- FixedTokenProvider
- IAuthenticator
- IClaimsetProvider
- IEndpointProvider
- IHttpClientProvider
- IKeySetProvider
- IPersistantStorage
- ITokenProvider
- IsolatedFileStorage
- LoggingHandler
- OnBehalfGrantTokenProvider
- OpenIdEndpointProvider
- #ctor(configurationEndpoint,productName)
- #ctor(configurationEndpoint,tokenRevocationEndpoint)
- Production
- Staging
- RetrieveAuthorizationEndpoint()
- RetrieveDeviceAuthorizationEndpoint()
- RetrieveEndSessionEndpoint()
- RetrieveJSONWebKeySetEndpoint()
- RetrieveTokenEndpoint()
- RetrieveTokenRevocationEndpoint()
- RetrieveUserInfoEndpoint()
- OpenIdKeySetProvider
- RefreshableTokenProvider
- RefreshableTokenProvider`1
- #ctor(endpointProvider,consumerKey,productName)
- #ctor(endpointProvider,consumerKey,consumerSecret,accessToken,tokenExpiry,idToken,refreshToken)
- _clientId
- _clientSecret
- _endpointProvider
- _gaParameters
- _messageHandler
- CheckIsOnline()
- ConvertToUrlSafeBase64String()
- GenerateCodeVerifier()
- GetSilentTokenAsync(cancellationToken)
- RetrieveCodeVerifier()
- RetrieveIdToken()
- RetrieveRefreshToken()
- RetrieveToken()
- RetrieveTokenAsync()
- RevokeRefreshToken()
- WithAccessToken(accessToken,tokenExpiry)
- WithConsumerSecret(clientSecret)
- WithIdToken(idToken)
- WithOfflineAccess()
- WithPersistentStorage(persistentStorage)
- WithProofKeyForCodeExchange(codeVerifier)
- WithRefreshToken(refreshToken)
- WithRetryConfiguration(maxRetries,retryDelayInSeconds)
- _GenerateCodeChallenge()
- TokenRefreshException
- TokenRefreshedEventArgs
- TokenValidationOptions
- UserInfo
- ValidatedClaimsetProvider
AccessToken type
Namespace
Trimble.ID
Summary
Represents Trimble identity access token with expiry information.
#ctor(accessToken,expiresOn) constructor
Summary
Creates a new instance of AccessToken using the provided accessToken and expiresOn.
Parameters
| Name | Type | Description |
|---|---|---|
| accessToken | System.String | The access token value. |
| expiresOn | System.DateTimeOffset | The access token expiry date. |
ExpiresOn property
Summary
Gets the time when the provided token expires.
Token property
Summary
Get the access token value.
Equals() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
GetHashCode() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
AuthorizationCodeGrantTokenProvider type
Namespace
Trimble.ID
Summary
A token provider based on the OAuth Authorization Code grant type
Example
const string CONSUMER_KEY = "APPLICATION_CONSUMER_KEY";const string CONSUMER_SECRET = "APPLICATION_CONSUMER_SECRET";const string REDIRECT_URL = "http://localhost:8080";const string AUTHORIZATION_ENDPOINT = "https://id.trimble.com/oauth/authorize";const string TOKEN_ENDPOINT = "https://id.trimble.com/oauth/token?tenantDomain=trimble.com";IEndpointProvider endpointProvider = new FixedEndpointProvider(new Uri(AUTHORIZATION_ENDPOINT, UriKind.Absolute), new Uri(TOKEN_ENDPOINT, UriKind.Absolute));ITokenProvider tokenProvider = new AuthorizationCodeGrantTokenProvider(endpointProvider, CONSUMER_KEY, REDIRECT_URL) .WithConsumerSecret(CONSUMER_SECRET) .WithScopes(new[] string { "scope" });var token = await tokenProvider.RetrieveToken();Remarks
Implements ITokenProvider
#ctor(endpointProvider,clientId,redirectUrl,productName) constructor
Summary
Public constructor for AuthorizationCodeGrantTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity authorization and token endpoints |
| clientId | System.String | The client Id for the calling application |
| redirectUrl | System.String | The URL to which Trimble Identity should redirect after successfully authenticating a user |
| productName | System.String | The product name of the consuming application (Optional). |
#ctor(endpointProvider,clientId,redirectUri,productName) constructor
Summary
Public constructor for AuthorizationCodeGrantTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity authorization and token endpoints |
| clientId | System.String | The client Id for the calling application |
| redirectUri | System.Uri | The URL to which Trimble Identity should redirect after successfully authenticating a user |
| productName | System.String | The product name of the consuming application (Optional). |
Remarks
This is provided as a convienence method, be aware it is critical to ensure that redirectUri.AbsoluteUri matches the value specified when creating the application
State property
GetOAuthLogoutRedirect(state) method
Summary
Return a redirect URL to log out of all Trimble Identity applications
Returns
A Task that resolves to the value of the redirect URL on completion
Parameters
| Name | Type | Description |
|---|---|---|
| state | System.String | An optional state parameter that will be passed back to the caller via the redirect URL |
Exceptions
| Name | Description |
|---|---|
| System.InvalidOperationException | Thrown when an ID token is not available |
GetOAuthRedirect(state,prompt) method
Summary
Get a redirect URL for Trimble Identity
Returns
An awaitable Task that resolves to the redirect URL
Parameters
| Name | Type | Description |
|---|---|---|
| state | System.String | An optional state parameter that will be passed back to the caller via the redirect URL |
| prompt | System.Boolean | This parameter is optional and determines whether to display the login UI. The default value is True. |
Exceptions
| Name | Description |
|---|---|
| Trimble.ID.AuthorizationFailedException | Thrown when an authorization endpoint is not provided by the endpoint provider |
ValidateCode(code) method
Summary
Validate the code parameter passed to the application by Trimble Identity
Returns
True if the code is valid
Parameters
| Name | Type | Description |
|---|---|---|
| code | System.String | The code query string from the URL |
Exceptions
| Name | Description |
|---|---|
| Trimble.ID.AuthorizationFailedException | Thrown when failed to validate the given auth code |
ValidateQuery(query) method
Summary
Validate the query parameters passed back to the application by Trimble Identity
Returns
True if the query string is valid
Parameters
| Name | Type | Description |
|---|---|---|
| query | System.String | The query string from the URL |
Exceptions
| Name | Description |
|---|---|
| Trimble.ID.AuthorizationFailedException | Thrown when failed to validate the given auth code |
WithIdentityProvider(identityProvider) method
Summary
Add Identity Provider to the authorization URL
Parameters
| Name | Type | Description |
|---|---|---|
| identityProvider | System.String | An optional parameter which specifies a federated identity provider that should be used to authenticate |
WithLogoutRedirect(logoutRedirectUrl) method
Summary
Add Redirect URL to an AuthorizationCodeGrantTokenProvider
Parameters
| Name | Type | Description |
|---|---|---|
| logoutRedirectUrl | System.String | A URL which the browser will return to after logout |
Remarks
This URL must match one of the URLs configured for the calling client
WithLogoutRedirect(logoutRedirectUri) method
Summary
Add Redirect URL to an AuthorizationCodeGrantTokenProvider
Parameters
| Name | Type | Description |
|---|---|---|
| logoutRedirectUri | System.Uri | A URL which the browser will return to after logout |
Remarks
This URL must match one of the URLs configured for the calling client
WithScopes(scopes) method
Summary
Fluent extension for adding scopes
Parameters
| Name | Type | Description |
|---|---|---|
| scopes | System.Collections.Generic.IEnumerable{System.String} | The requested scopes |
AuthorizationFailedException type
Namespace
Trimble.ID
Summary
An exception class raised for errors in authorizing client requests.
#ctor(message) constructor
Summary
Creates a new AuthorizationFailedException with the specified message.
Parameters
| Name | Type | Description |
|---|---|---|
| message | System.String |
#ctor(message,innerException) constructor
Summary
Creates a new AuthorizationFailedException with the specified message.
Parameters
| Name | Type | Description |
|---|---|---|
| message | System.String | The message describing the authorization failure. |
| innerException | System.Exception | The exception underlying the authorization failure. |
BearerTokenHttpClientProvider type
Namespace
Trimble.ID
Summary
A HttpClient provider for APIs using Bearer token authorization
Example
const string API_BASE_URL = "https://api-usw2.trimblepaas.com/data_ocean-v1.0";const string TOKEN = "USER_OR_APPLICATION_ACCESS_TOKEN";ITokenProvider tokenProvider = new FixedTokenProvider(TOKEN);IHttpClientProvider httpclientProvider = new BearerTokenHttpClientProvider(tokenProvider, new Uri(API_BASE_URL, UriKind.Absolute));var httpClient = await httpclientProvider.RetrieveClient();Remarks
Implements IHttpClientProvider
#ctor(tokenProvider,baseAddress,productName) constructor
Summary
Public constructor for BearerTokenHttpClientProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| tokenProvider | Trimble.ID.ITokenProvider | A token provider that provides the access token for the authenticated application or user |
| baseAddress | System.Uri | The base address for the API that will be called |
| productName | System.String | The product name of the consuming application (Optional). |
Remarks
Implements IHttpClientProvider
ClientId property
Summary
Gets the client ID.
Logger property
Summary
Gets or sets the logger for this HTTP client provider
GetClientIdAsync() method
Summary
Gets the client ID asynchronously.
Parameters
This method has no parameters.
RetrieveClient() method
Summary
Retrieves a preconfigured HttpClient to access a given API
Returns
A Task that resolves to the value of the preconfigured HttpClient on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown when a token is not provided by the token provider |
SetHttpMessageHandler(handler) method
Summary
Sets the HTTP message handler to be used by the client provider.
Parameters
| Name | Type | Description |
|---|---|---|
| handler | System.Net.Http.HttpMessageHandler | The HTTP message handler to be set. |
ClientCredentialTokenProvider type
Namespace
Trimble.ID
Summary
A token provider based on the OAuth Client Credential grant type
Example
const string CLIENT_ID = "APPLICATION_CLIENT_ID";const string CLIENT_SECRET = "APPLICATION_CLIENT_SECRET";const string TOKEN_ENDPOINT = "https://id.trimble.com/oauth/token?tenantDomain=trimble.com";IEndpointProvider endpointProvider = new FixedEndpointProvider(tokenEndpoint: new Uri(TOKEN_ENDPOINT, UriKind.Absolute));ITokenProvider tokenProvider = new ClientCredentialTokenProvider(endpointProvider, CLIENT_ID, CLIENT_SECRET).WithScopes(new[] string { "scope" });var token = await tokenProvider.RetrieveToken();Remarks
Implements ITokenProvider
#ctor(endpointProvider,consumerKey,consumerSecret,productName) constructor
Summary
Public constructor for ClientCredentialTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity token endpoint |
| consumerKey | System.String | The consumer key for the calling application |
| consumerSecret | System.String | The consumer secret for the calling application |
| productName | System.String | The product name of the consuming application (Optional). |
Remarks
Implements ITokenProvider
RetrieveToken() method
Summary
Retrieves an access token for the application
Returns
A Task that resolves to the value of the access token on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| Trimble.ID.AuthorizationFailedException | Thrown when a call to the token endpoint fails to obtain token |
RetrieveTokenAsync() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
WithScopes(scopes) method
Summary
Fluent extension for adding scopes
Parameters
| Name | Type | Description |
|---|---|---|
| scopes | System.Collections.Generic.IEnumerable{System.String} | The requested scopes |
DeviceAuthorizationResponse type
Namespace
Trimble.ID
Summary
Represents the response of DeviceAuthorization.
DeviceCode property
Summary
Gets or sets the device code.
ExpiresIn property
Summary
Gets or sets the expiration time in seconds.
Interval property
Summary
Gets or sets the interval.
UserCode property
Summary
Gets or sets the user code.
VerificationUri property
Summary
Gets or sets the verification URI.
VerificationUriComplete property
Summary
Gets or sets the complete verification URI.
DeviceAuthorizationStatus type
Namespace
Trimble.ID
Summary
Represents the authorization status of a device.
ACCESS_DENIED constants
Summary
Access denied authorization status.
ACCESS_GRANTED constants
Summary
Access granted authorization status.
AUTHORIZATION_PENDING constants
Summary
Authorization pending authorization status.
CODE_EXPIRED constants
Summary
Code expired authorization status.
NONE constants
Summary
No authorization status.
SLOW_DOWN constants
Summary
Slow down authorization status.
DeviceAuthorizationTokenProvider type
Namespace
Trimble.ID
Summary
A token provider based on the Device Authorization grant type
Remarks
Implements ITokenProvider
#ctor(endpointProvider,clientId,productName) constructor
Summary
Public constructor for DeviceAuthorizationTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity token endpoint |
| clientId | System.String | The consumer key for the calling application |
| productName | System.String | The product name of the consuming application (Optional). |
CreateAuthorization() method
Summary
Request authorization
Returns
DeviceAuthorizationResponse that contains user code, device code and verification uri
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown when a call to the device authorization endpoint fails |
PerformTokenRequest(deviceCode,pollInterval,timeout,onCallback,cancellationToken) method
Summary
Performs token request
Parameters
| Name | Type | Description |
|---|---|---|
| deviceCode | System.String | Device code to perform token request |
| pollInterval | System.Int32 | Time interval between each request |
| timeout | System.Int32 | The maximum time until the request times out |
| onCallback | System.Action{Trimble.ID.DeviceAuthorizationStatus} | Callback method to check whether the device has been authorized |
| cancellationToken | System.Threading.CancellationToken | Cancellation token |
Exceptions
| Name | Description |
|---|---|
| System.TimeoutException | Thrown when a token request times out |
| Trimble.ID.AuthorizationFailedException | Thrown when a call to device authoiration fails |
RetrieveIdToken() method
Summary
Retrieves a id token for the application
Returns
A Task that resolves to the value of the ID token on completion
Parameters
This method has no parameters.
RetrieveRefreshToken() method
Summary
Retrieves a refresh token for the application
Returns
A Task that resolves to the value of the refresh token on completion
Parameters
This method has no parameters.
RetrieveToken() method
Summary
Retrieves an access token for the application
Returns
A Task that resolves to the value of the access token on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| Trimble.ID.TokenRefreshException | Thrown when a call to the token endpoint fails |
RetrieveTokenAsync() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
WithClientSecret(clientSecret) method
Summary
Fluent extension for adding client secret
Parameters
| Name | Type | Description |
|---|---|---|
| clientSecret | System.String | The client secret for the calling application |
WithScopes(scopes) method
Summary
Fluent extension for adding scopes
Parameters
| Name | Type | Description |
|---|---|---|
| scopes | System.Collections.Generic.IEnumerable{System.String} | The requested scopes |
DeviceTokenErrorResponse type
Namespace
Trimble.ID
Summary
Represents the device token error response.
Error property
Summary
Gets or sets the error message.
ErrorDescription property
Summary
Gets or sets the error description.
EncryptedStorage type
Namespace
Trimble.ID
Summary
Wrapper for IPersistantStorage that adds encryption functionality
#ctor() constructor
Summary
Constructor
Parameters
This constructor has no parameters.
CombineEntropy() method
Summary
Combines the secret with additional entropy
Parameters
This method has no parameters.
GetItem() method
Summary
Retrieve a named value from persistant storage
Parameters
This method has no parameters.
RemoveItem() method
Summary
Remove a named value from persistant storage
Parameters
This method has no parameters.
SetItem() method
Summary
Store a named value in persistant storage
Parameters
This method has no parameters.
ErrorMessage type
Namespace
Trimble.ID
Summary
The Authorization Error messages.
FailedToGetToken constants
Summary
The error message.
FailedToRefreshToken constants
Summary
The error message.
FailedToReturnOAuthRedirect constants
Summary
The error message.
FailedToValidateOAuthCode constants
Summary
The error message.
IdTokenIsRequired constants
Summary
The error message.
NoKeysetEndpointProvider constants
Summary
The error message.
RefreshTokenIsNullOrEmpty constants
Summary
Error message for when refresh token is null or empty
TokenRefreshFailed constants
Summary
Error message for failed token refresh
FixedEndpointProvider type
Namespace
Trimble.ID
Summary
An endpoint provider that returns fixed values
Example
const string AUTHORIZATION_ENDPOINT = "https://id.trimble.com/oauth/authorize";const string TOKEN_ENDPOINT = "https://id.trimble.com/oauth/token?tenantDomain=trimble.com";IEndpointProvider endpointProvider = new FixedEndpointProvider() .WithAuthorizationEndpoint(new Uri(AUTHORIZATION_ENDPOINT, UriKind.Absolute)) .WithTokenEndpoint(new Uri(TOKEN_ENDPOINT, UriKind.Absolute));var authorizationEndpoint = await endpointProvider.RetrieveAuthorizationEndpoint();var tokenEndpoint = await endpointProvider.RetrieveTokenEndpoint();Remarks
Implements IEndpointProvider
#ctor(productName) constructor
Summary
Public constructor for FixedEndpointProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| productName | System.String | The product name of the consuming application (Optional). |
#ctor() constructor
Summary
Protected copy constructor for FixedEndpointProvider class
Parameters
This constructor has no parameters.
#ctor(authorizationEndpoint,tokenEndpoint,userInfoEndpoint,tokenRevocationEndpoint,jwksEndpoint,endSessionEndpoint,deviceAuthorizationEndpoint) constructor
Summary
Public constructor for FixedEndpointProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| authorizationEndpoint | System.Uri | The URL for the Trimble Identity authorization endpoint |
| tokenEndpoint | System.Uri | The URL for the Trimble Identity token endpoint |
| userInfoEndpoint | System.Uri | The URL for the Trimble Identity user information endpoint |
| tokenRevocationEndpoint | System.Uri | The URL for the Trimble Identity token revocation endpoint, if not supplied this is computed relative to the token endpoint |
| jwksEndpoint | System.Uri | The URL for the Trimble Identity JSON web keyset endpoint |
| endSessionEndpoint | System.Uri | The URL for the Trimble Identity end session endpoint, if not supplied this is computed relative to the token endpoint |
| deviceAuthorizationEndpoint | System.Uri | The URL for the Trimble Identity device authorization endpoint |
Remarks
Implements IEndpointProvider
RetrieveAuthorizationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveDeviceAuthorizationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity device authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveEndSessionEndpoint() method
Summary
Retrieves a URL for the Trimble Identity token revocation endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveJSONWebKeySetEndpoint() method
Summary
Retrieves a URL for the Trimble Identity JSON web keyset endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveTokenEndpoint() method
Summary
Retrieves a URL for the Trimble Identity token endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveTokenRevocationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity token revocation endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveUserInfoEndpoint() method
Summary
Retrieves a URL for the Trimble Identity user information endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
WithAuthorizationEndpoint(authorizationEndpoint) method
Summary
Add an authorization endpoint
Returns
A new instance of a FixedEndpointProvider
Parameters
| Name | Type | Description |
|---|---|---|
| authorizationEndpoint | System.Uri | The URL for the Trimble Identity authorization endpoint |
WithDeviceAuthorizationEndpoint(deviceAuthorizationEndpoint) method
Returns
A new instance of a FixedEndpointProvider
Parameters
| Name | Type | Description |
|---|---|---|
| deviceAuthorizationEndpoint | System.Uri | The URL for the Trimble Identity device authorization endpoint |
WithEndSessionEndpoint(endSessionEndpoint) method
Summary
Add an end session endpoint
Returns
A new instance of a FixedEndpointProvider
Parameters
| Name | Type | Description |
|---|---|---|
| endSessionEndpoint | System.Uri | The URL for the Trimble Identity end session endpoint, if not supplied this is computed relative to the token endpoint |
WithJWKSEndpoint(jwksEndpoint) method
Summary
Add a JWKS endpoint
Returns
A new instance of a FixedEndpointProvider
Parameters
| Name | Type | Description |
|---|---|---|
| jwksEndpoint | System.Uri | The URL for the Trimble Identity JSON web keyset endpoint |
WithTokenEndpoint(tokenEndpoint) method
Summary
Add a token endpoint
Returns
A new instance of a FixedEndpointProvider
Parameters
| Name | Type | Description |
|---|---|---|
| tokenEndpoint | System.Uri | The URL for the Trimble Identity token endpoint |
WithTokenRevocationEndpoint(tokenRevocationEndpoint) method
Summary
Add a token revocation endpoint
Returns
A new instance of a FixedEndpointProvider
Parameters
| Name | Type | Description |
|---|---|---|
| tokenRevocationEndpoint | System.Uri | The URL for the Trimble Identity token revocation endpoint, if not supplied this is computed relative to the token endpoint |
WithUserInfoEndpoint(userInfoEndpoint) method
Summary
Add a user info endpoint
Returns
A new instance of a FixedEndpointProvider
Parameters
| Name | Type | Description |
|---|---|---|
| userInfoEndpoint | System.Uri | The URL for the Trimble Identity user information endpoint |
FixedKeySetProvider type
Namespace
Trimble.ID
Summary
A keyset provider that returns a fixed keyset
Example
var keyset = new Dictionary<string, RSACryptoServiceProvider>)(); var key = new RSACryptoServiceProvider(); key.ImportParameters(new RSAParameters() { Modulus = Base64Url.Decode("nzyis1ZjfNB0bBgK..."), Exponent = Base64Url.Decode("AQAB") }); keyset.Add("31824ffd-777e-458a-a3b6-2808f64a0bdd", key); IKeySetProvider keysetProvider = new FixedKeySetProvider(keyset); var keyset = await keysetProvider.RetrieveKeySet();Remarks
Implements IKeysetProvider
#ctor(keyset) constructor
Summary
Public constructor for FixedKeySetProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| keyset | System.Collections.Generic.Dictionary{System.String,System.Security.Cryptography.RSACryptoServiceProvider} | A dictionary of named keys |
Remarks
Implements IKeySetProvider
RetrieveKeySet() method
Summary
Retrieves an dictionary of named keys
Returns
A Task that resolves to a dictionary of named keys on completion
Parameters
This method has no parameters.
FixedTokenProvider type
Namespace
Trimble.ID
Summary
A token provider that returns a fixed token
Example
const string TOKEN = "USER_OR_APPLICATION_ACCESS_TOKEN";ITokenProvider tokenProvider = new FixedTokenProvider(TOKEN);var token = await tokenProvider.RetrieveToken();Remarks
Implements ITokenProvider
#ctor(token,productName) constructor
Summary
Public constructor for FixedTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| token | System.String | The fixed token to return |
| productName | System.String | The product name of the consuming application (Optional). |
Remarks
Implements ITokenProvider
#ctor(token,expiresIn,productName) constructor
Summary
Public constructor for FixedTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| token | System.String | The fixed token to return |
| expiresIn | System.Int32 | The expiration time of the token in seconds |
| productName | System.String | The product name of the consuming application (Optional). |
Remarks
Implements ITokenProvider
RetrieveToken() method
Summary
Retrieves an access token for the user or application
Returns
A Task that resolves to the value of the access token on completion
Parameters
This method has no parameters.
RetrieveTokenAsync() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
IAuthenticator type
Namespace
Trimble.ID
Summary
Common interface for authenticators
IsLoggedIn property
Summary
Get the logged in state
LegacyTokenProvider property
Summary
Get the token provider for this authenticator
Remarks
This token provider can be used with other SDK components
TokenProvider property
Summary
Get the token provider for this authenticator
Remarks
This token provider can be used with other SDK components
GetUserInfo() method
Summary
Validates the ID token and returns user claims
Returns
User claims from the ID token
Parameters
This method has no parameters.
Login(silent,timeoutInMs,cancellationToken) method
Summary
Log the user in
Returns
true if the user was successfully logged in
Parameters
| Name | Type | Description |
|---|---|---|
| silent | System.Boolean | true if no UI should be shown i.e. prompt=none |
| timeoutInMs | System.Int32 | Specify the length of time that client waits for a login response when making a login attempt. The default timeout value is 3 minutes. |
| cancellationToken | System.Threading.CancellationToken | Token which can be used to cancel the task. |
Exceptions
| Name | Description |
|---|---|
| System.TimeoutException | Login operation has timed out after waiting for specified time. |
| System.Threading.Tasks.TaskCanceledException | The task is cancelled for specified time. |
Logout(singleSignOut,cancellationToken) method
Summary
Log the user out
Returns
true if the user was successfully logged out
Parameters
| Name | Type | Description |
|---|---|---|
| singleSignOut | System.Boolean | true if the single sign in session should be terminated |
| cancellationToken | System.Threading.CancellationToken | Token which can be used to cancel the task. |
Exceptions
| Name | Description |
|---|---|
| System.Threading.Tasks.TaskCanceledException | The task is cancelled for specified time. |
IClaimsetProvider type
Namespace
Trimble.ID
Summary
Common interface for claimset providers
RetrieveClaimset() method
Summary
Retrieves a validate claimset from a given JSON web token
Returns
A Task that resolves to the claimset completion
Parameters
This method has no parameters.
IEndpointProvider type
Namespace
Trimble.ID
Summary
Common interface for endpoint providers
RetrieveAuthorizationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveDeviceAuthorizationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity device authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveEndSessionEndpoint() method
Summary
Retrieves a URL for the Trimble Identity end session endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveJSONWebKeySetEndpoint() method
Summary
Retrieves a URL for the Trimble Identity JSON web keyset endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveTokenEndpoint() method
Summary
Retrieves a URL for the Trimble Identity token endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveTokenRevocationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity token revocation endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveUserInfoEndpoint() method
Summary
Retrieves a URL for the Trimble Identity user information endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
IHttpClientProvider type
Namespace
Trimble.ID
Summary
Common interface for all HTTP client providers
ClientId property
Summary
The ClientId for the calling application
RetrieveClient() method
Summary
Retrieves a preconfigured HttpClient to access a given API
Returns
A Task that resolves to the value of the preconfigured HttpClient on completion
Parameters
This method has no parameters.
SetHttpMessageHandler(handler) method
Summary
Sets an additional and optional HttpMessageHandler.
Parameters
| Name | Type | Description |
|---|---|---|
| handler | System.Net.Http.HttpMessageHandler | The handler. |
IKeySetProvider type
Namespace
Trimble.ID
Summary
Common interface for all key set providers
RetrieveKeySet() method
Summary
Returns a Task that resolves to a key set
Parameters
This method has no parameters.
IPersistantStorage type
Namespace
Trimble.ID
Summary
Interface for persistant storage
GetItem() method
Summary
Retrieve a named value from persistant storage
Parameters
This method has no parameters.
RemoveItem() method
Summary
Remove a named value from persistant storage
Parameters
This method has no parameters.
SetItem() method
Summary
Store a named value in persistant storage
Parameters
This method has no parameters.
ITokenProvider type
Namespace
Trimble.ID
Summary
Interface implemented by all token providers
RetrieveToken() method
Summary
Retrieves an access token for the authenticated application or user
Returns
A Task that resolves to the value of the access token on completion
Parameters
This method has no parameters.
RetrieveTokenAsync(cancellationToken) method
Summary
Retrieves an access token asynchronously for the authenticated application or user
Returns
An AccessToken which can be used to authenticate service client calls.
Parameters
| Name | Type | Description |
|---|---|---|
| cancellationToken | System.Threading.CancellationToken | A CancellationToken controlling the request lifetime. |
IsolatedFileStorage type
Namespace
Trimble.ID
Summary
Wrapper for IPersistantStorage that adds encryption functionality
#ctor() constructor
Summary
Constructor
Parameters
This constructor has no parameters.
GetItem() method
Summary
Retrieve a named value from persistant storage
Parameters
This method has no parameters.
RemoveItem() method
Summary
Remove a named value from persistant storage
Parameters
This method has no parameters.
SetItem() method
Summary
Store a named value in persistant storage
Parameters
This method has no parameters.
LoggingHandler type
Namespace
Trimble.ID
Summary
Represents a logging handler for HTTP requests and responses.
#ctor(logger) constructor
Summary
Initializes a new instance of the LoggingHandler class.
Parameters
| Name | Type | Description |
|---|---|---|
| logger | TrimbleCloud.Common.Logging.ILogger | The logger instance. |
SendAsync(request,cancellationToken) method
Summary
Sends an HTTP request and logs the request and response.
Returns
The HTTP response message.
Parameters
| Name | Type | Description |
|---|---|---|
| request | System.Net.Http.HttpRequestMessage | The HTTP request message. |
| cancellationToken | System.Threading.CancellationToken | The cancellation token. |
OnBehalfGrantTokenProvider type
Namespace
Trimble.ID
Summary
A token provider based on the OAuth On Behalf grant type
Example
const string CLIENT_ID = "APPLICATION_CLIENT_ID";const string CLIENT_SECRET = "APPLICATION_CLIENT_SECRET";var accessToken = "CALLERS_ACCESS_TOKEN";const string TOKEN_ENDPOINT = "https://id.trimble.com/oauth/token";IEndpointProvider endpointProvider = new FixedEndpointProvider(tokenEndpoint: new Uri(TOKEN_ENDPOINT, UriKind.Absolute));ITokenProvider tokenProvider = new OnBehalfGrantTokenProvider(endpointProvider, CLIENT_ID, CLIENT_SECRET, accessToken);var token = await tokenProvider.RetrieveToken();Remarks
Implements ITokenProvider
#ctor(endpointProvider,consumerKey,consumerSecret,accessToken,productName) constructor
Summary
Public constructor for OnBehalfTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity token endpoints |
| consumerKey | System.String | The consumer key for the calling application |
| consumerSecret | System.String | The consumer secret for the calling application |
| accessToken | System.String | The access token for the authenticated user that this application wishes to act on behalf of when calling another API |
| productName | System.String | The product name of the consuming application (Optional). |
Remarks
Implements ITokenProvider
RetrieveToken() method
Summary
Retrieves an access token for the application
Returns
A Task that resolves to the value of the access token on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| Trimble.ID.AuthorizationFailedException | Thrown when a call to the token endpoint fails |
RetrieveTokenAsync() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
WithScopes(scopes) method
Summary
Fluent extension for adding scopes
Parameters
| Name | Type | Description |
|---|---|---|
| scopes | System.Collections.Generic.IEnumerable{System.String} | The requested scopes |
OpenIdEndpointProvider type
Namespace
Trimble.ID
Summary
An endpoint provider that returns values from a OpenID well known configuration
Example
const string PROD_CONFIGURATION_ENDPOINT = "https://id.trimble.com/.well-known/openid-configuration";const string STAGE_CONFIGURATION_ENDPOINT = "https://stage.id.trimblecloud.com/.well-known/openid-configuration";IEndpointProvider endpointProvider = new OpenIdEndpointProvider(new Uri(PROD_CONFIGURATION_ENDPOINT, UriKind.Absolute));var authorizationEndpoint = await endpointProvider.RetrieveAuthorizationEndpoint();var tokenEndpoint = await endpointProvider.RetrieveTokenEndpoint();Remarks
Implements IEndpointProvider
#ctor(configurationEndpoint,productName) constructor
Summary
Public constructor for OpenIdEndpointProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| configurationEndpoint | System.Uri | The URL for the Trimble Identity OpenID well know configuration endpoint |
| productName | System.String | The product name of the consuming application (optional). |
#ctor(configurationEndpoint,tokenRevocationEndpoint) constructor
Summary
Public constructor for OpenIdEndpointProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| configurationEndpoint | System.Uri | The URL for the Trimble Identity OpenID well know configuration endpoint |
| tokenRevocationEndpoint | System.Uri | The URL for the Trimble Identity token revocation endpoint, if not supplied this is computed relative to the token endpoint |
Production property
Staging property
RetrieveAuthorizationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown if the configuration endpoint returns an error |
RetrieveDeviceAuthorizationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity device authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown if the configuration endpoint returns an error |
RetrieveEndSessionEndpoint() method
Summary
Retrieves a URL for the Trimble Identity token revocation endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
RetrieveJSONWebKeySetEndpoint() method
Summary
Retrieves a URL for the Trimble Identity authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown if the configuration endpoint returns an error |
RetrieveTokenEndpoint() method
Summary
Retrieves a URL for the Trimble Identity authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown if the configuration endpoint returns an error |
RetrieveTokenRevocationEndpoint() method
Summary
Retrieves a URL for the Trimble Identity authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown if the configuration endpoint returns an error |
RetrieveUserInfoEndpoint() method
Summary
Retrieves a URL for the Trimble Identity authorization endpoint
Returns
A Task that resolves to the value of the URL on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown if the configuration endpoint returns an error |
OpenIdKeySetProvider type
Namespace
Trimble.ID
Summary
A keyset provider based on the OAuth well known configuration
Example
const string JWKS_ENDPOINT = "https://id.trimble.com/.well-known/jwks.json";var endpointProvider = new FixedEndpointProvider(jwksEndpoint: new Uri(JWKS_ENDPOINT, UriKind.Absolute));IKeySetProvider keysetProvider = new OpenIdKeySetProvider(endpointProvider);var keyset = await keysetProvider.RetrieveKeySet();Remarks
Implements IKeysetProvider
#ctor(endpointProvider,productName) constructor
Summary
Public constructor for OpenIdKeySetProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity JSON web keyset endpoint |
| productName | System.String | The product name of the consuming application (optional). |
Remarks
Implements IKeySetProvider
RetrieveKeySet() method
Summary
Retrieves an dictionary of named keys
Returns
A Task that resolves to a dictionary of named keys on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown when a JSON web keyset endpoint is not provided by the endpoint provider |
| System.Exception | Thrown when a call to the JSON web keyset endpoint fails |
RefreshableTokenProvider type
Namespace
Trimble.ID
Summary
Class to allow instansiation of RefreshableTokenProvider
#ctor(endpointProvider,consumerKey,productName) constructor
Summary
Public constructor for RefreshableTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity token endpoint |
| consumerKey | System.String | The consumer key for the calling application |
| productName | System.String | The product name of the consuming application (optional). |
Remarks
Implements ITokenProvider
RefreshableTokenProvider`1 type
Namespace
Trimble.ID
Summary
A token provider based on the OAuth refresh grant type
Remarks
Implements ITokenProvider
#ctor(endpointProvider,consumerKey,productName) constructor
Summary
Public constructor for RefreshableTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity token endpoint |
| consumerKey | System.String | The consumer key for the calling application |
| productName | System.String | The product name of the consuming application (optional). |
Remarks
Implements ITokenProvider
#ctor(endpointProvider,consumerKey,consumerSecret,accessToken,tokenExpiry,idToken,refreshToken) constructor
Summary
Public constructor for RefreshableTokenProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity token endpoint |
| consumerKey | System.String | The consumer key for the calling application |
| consumerSecret | System.String | The consumer secret for the calling application |
| accessToken | System.String | The initial access token issued for the authenticated user |
| tokenExpiry | System.DateTime | The expiry time for the initial access token issued for the authenticated user |
| idToken | System.String | The ID token for the authenticated user |
| refreshToken | System.String | The refresh token for the authenticated user |
Remarks
Implements ITokenProvider
_clientId constants
_clientSecret constants
_endpointProvider constants
_gaParameters constants
_messageHandler constants
CheckIsOnline() method
Summary
Checks online state.
Returns
True if online.
Parameters
This method has no parameters.
ConvertToUrlSafeBase64String() method
Parameters
This method has no parameters.
GenerateCodeVerifier() method
Summary
Static method to generate a code verifier
Returns
A code verifier string
Parameters
This method has no parameters.
GetSilentTokenAsync(cancellationToken) method
Summary
Get a token silently. Use CrossPlatLock to synchronize access to the cache only if the cache is stored in IsolatedFileStorage.
Returns
Parameters
| Name | Type | Description |
|---|---|---|
| cancellationToken | System.Threading.CancellationToken |
RetrieveCodeVerifier() method
Summary
Retrieves a code verifier for the authenticated user for PKCE grant flow
Returns
A Task that resolves to the value of the code verifier on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown when a token endpoint is not provided by the endpoint provider |
| System.Exception | Thrown when a call to the token endpoint fails |
RetrieveIdToken() method
Summary
Retrieves an ID token for the authenticated user
Returns
A Task that resolves to the value of the ID token on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown when a token endpoint is not provided by the endpoint provider |
| System.Exception | Thrown when a call to the token endpoint fails |
RetrieveRefreshToken() method
Summary
Retrieves a refresh token for the authenticated user
Returns
A Task that resolves to the value of the refresh token on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown when a token endpoint is not provided by the endpoint provider |
| System.Exception | Thrown when a call to the token endpoint fails |
RetrieveToken() method
Summary
Retrieves an access token for the authenticated user
Returns
A Task that resolves to the value of the access token on completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| Trimble.ID.TokenRefreshException | Thrown when a call to the token endpoint fails |
RetrieveTokenAsync() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
RevokeRefreshToken() method
Summary
Revokes a refresh token for the authenticated user
Parameters
This method has no parameters.
WithAccessToken(accessToken,tokenExpiry) method
Summary
Fluent method for RefreshableTokenProvider class
Returns
The current RefreshableTokenProvider
Parameters
| Name | Type | Description |
|---|---|---|
| accessToken | System.String | The initial access token issued for the authenticated user |
| tokenExpiry | System.DateTime | The expiry time for the initial access token issued for the authenticated user |
WithConsumerSecret(clientSecret) method
Summary
Fluent method for RefreshableTokenProvider class
Returns
The current RefreshableTokenProvider
Parameters
| Name | Type | Description |
|---|---|---|
| clientSecret | System.String | The client secret for the calling application |
WithIdToken(idToken) method
Summary
Fluent method for RefreshableTokenProvider class
Returns
The current RefreshableTokenProvider
Parameters
| Name | Type | Description |
|---|---|---|
| idToken | System.String | The ID token for the authenticated user |
WithOfflineAccess() method
Summary
Fluent method for enabling offline access
Returns
The current RefreshableTokenProvider
Parameters
This method has no parameters.
WithPersistentStorage(persistentStorage) method
Summary
Fluent method for RefreshableTokenProvider class
Returns
The current RefreshableTokenProvider
Parameters
| Name | Type | Description |
|---|---|---|
| persistentStorage | Trimble.ID.IPersistantStorage | The persistent storage for the refresh token |
WithProofKeyForCodeExchange(codeVerifier) method
Summary
Fluent extension for Authorization Code with PKCE
Parameters
| Name | Type | Description |
|---|---|---|
| codeVerifier | System.String | The PKCE code verifier for the calling application |
WithRefreshToken(refreshToken) method
Summary
Fluent method for RefreshableTokenProvider class
Returns
The current RefreshableTokenProvider
Parameters
| Name | Type | Description |
|---|---|---|
| refreshToken | System.String | The refresh token for the authenticated user |
WithRetryConfiguration(maxRetries,retryDelayInSeconds) method
Summary
Fluent method to configure retry behavior
Returns
The current RefreshableTokenProvider
Parameters
| Name | Type | Description |
|---|---|---|
| maxRetries | System.Int32 | Maximum number of retries |
| retryDelayInSeconds | System.Int32 | Base delay between retries in seconds |
_GenerateCodeChallenge() method
Summary
Generate a code challenge for the current code verifier
Returns
The calculated code challenge
Parameters
This method has no parameters.
RetryHandler type
Namespace
Trimble.ID.Utilities
ExecuteWithRetryAsync“1(func,shouldRetryPredicate,maxRetries,retryDelay,cancellationToken) method
Summary
Executes the provided function with retry logic.
Returns
The result of the function execution.
Parameters
| Name | Type | Description |
|---|---|---|
| func | System.Func{System.Threading.Tasks.Task{“0}} | The function to execute. |
| shouldRetryPredicate | System.Func{System.Exception,System.Net.Http.HttpResponseMessage,System.Boolean} | Function to determine if retry should be attempted based on the exception. |
| maxRetries | System.Int32 | Maximum number of retry attempts. |
| retryDelay | System.Nullable{System.TimeSpan} | Base delay between retries (will be multiplied by retry count for backoff). |
| cancellationToken | System.Threading.CancellationToken | Cancellation token. |
Generic Types
| Name | Description |
|---|---|
| T | The return type of the function. |
ShouldRetryOnServerError(ex,response) method
Summary
Determines if the request should be retried based on the HTTP status code.
Returns
True if the request should be retried, otherwise false.
Parameters
| Name | Type | Description |
|---|---|---|
| ex | System.Exception | The exception that was thrown. |
| response | System.Net.Http.HttpResponseMessage | The HTTP response. |
TokenHandler type
Namespace
Trimble.ID
Summary
Represents a handler for adding authentication token to the request headers.
#ctor(tokenProvider) constructor
Summary
Initializes a new instance of the TokenHandler class.
Parameters
| Name | Type | Description |
|---|---|---|
| tokenProvider | Trimble.ID.ITokenProvider | The token provider used to retrieve the authentication token. |
_tokenProvider constants
Summary
Represents a handler that adds an authentication token to the request headers before sending the request.
SendAsync(request,cancellationToken) method
Summary
Sends the HTTP request with the added authentication token in the request headers.
Returns
The HTTP response message.
Parameters
| Name | Type | Description |
|---|---|---|
| request | System.Net.Http.HttpRequestMessage | The HTTP request message. |
| cancellationToken | System.Threading.CancellationToken | The cancellation token. |
TokenRefreshException type
Namespace
Trimble.ID
Summary
An exception class raised when a token refresh fails.
#ctor(message) constructor
Summary
Creates a new TokenRefreshException with the specified message.
Parameters
| Name | Type | Description |
|---|---|---|
| message | System.String |
#ctor(message,innerException) constructor
Summary
Creates a new TokenRefreshException with the specified message.
Parameters
| Name | Type | Description |
|---|---|---|
| message | System.String | The message describing the token refresh failure. |
| innerException | System.Exception | The exception underlying the token refresh failure. |
TokenRefreshedEventArgs type
Namespace
Summary
Represents the event arguments for token refreshed event.
#ctor(accessToken,expiresIn) constructor
Summary
Initializes a new instance of the TokenRefreshedEventArgs class.
Parameters
| Name | Type | Description |
|---|---|---|
| accessToken | System.String | The access token. |
| expiresIn | System.Int64 | The access token expiration time |
AccessToken property
Summary
Gets the access token.
TokenValidationOptions type
Namespace
Trimble.ID
Summary
Represents the options for token validation.
ClockSkew property
Summary
Gets or sets the clock skew for validating tokens.
Exceptions
| Name | Description |
|---|---|
| System.ArgumentOutOfRangeException | If ‘value’ is less than 0. |
UserInfo type
Namespace
Trimble.ID
Summary
User information
Email property
Summary
The user’s email address
EmailVerified property
Summary
The user’s email address verification status
FamilyName property
Summary
The user’s family name
GivenName property
Summary
The user’s given name
Id property
Summary
The user’s unique identifier
Picture property
Summary
A URL to the user’s profile picture
ValidatedClaimsetProvider type
Namespace
Trimble.ID
Summary
A claimset provider that returns a validated claimset
Example
var idToken = "USERS_ID_TOKEN";const string JWKS_ENDPOINT = "https://identity.trimble.com/openid-certs";IEndpointProvider endpointProvider = new FixedEndpointProvider(jwksEndpoint: new Uri(JWKS_ENDPOINT, UriKind.Absolute));IKeysetProvider keysetProvider = new OpenIdKeySetProvider(endpointProvider);IClaimsetProvider claimsetProvider = new ValidatedClaimsetProvider(keysetProvider);var claimset = await RetrieveClaimset(idToken);var userId = claimset["sub"];Remarks
Implements IKeysetProvider
#ctor(keysetProvider,productName) constructor
Summary
Public constructor for ValidatedClaimsetProvider class
Parameters
| Name | Type | Description |
|---|---|---|
| keysetProvider | Trimble.ID.IKeySetProvider | A provider for the keyset used to validate the JWT claimeset |
| productName | System.String | The product name of the consuming application (optional). |
Remarks
Implements IClaimsetProvider
RetrieveClaimset() method
Summary
Retrieves a validate claimset from a given JSON web token
Returns
A Task that resolves to the claimset completion
Parameters
This method has no parameters.
Exceptions
| Name | Description |
|---|---|
| System.Exception | Thrown when the keyset provider does not provide the named key |
| System.Exception | Thrown when the JSON web token is invalid |
WithOptions(options) method
Summary
Fluent extension for setting token validation Options
Returns
Parameters
| Name | Type | Description |
|---|---|---|
| options | Trimble.ID.TokenValidationOptions | Contains a set of validation options when validating the token |