Trimble.ID.Desktop
Trimble.ID.Desktop
Section titled “Trimble.ID.Desktop”Contents
Section titled “Contents”- Browser
- BrowserPreferences
- LocalhostAuthenticator
- #ctor(endpointProvider,consumerKey,scopes,productName)
- IsLoggedIn
- LegacyTokenProvider
- TokenProvider
- Dispose()
- Dispose()
- GetUserInfo()
- LoadCachedLogin()
- Login(silent,timeoutInMs,cancellationToken)
- Logout(singleSignOut,cancellationToken)
- WithBrowserPreferences(preferences)
- WithFixedPort(port)
- WithLoopbackAddress(address)
- WithOfflineAccess()
- WithPersistentStorage(persistentStorage)
- LocalhostListener
- TokenProviderWrapper
Browser type
Section titled “Browser type”Namespace
Section titled “Namespace”Trimble.ID.Desktop
Summary
Section titled “Summary”Provides methods to launch a URL in the default browser.
Launch() method
Section titled “Launch() method”Summary
Section titled “Summary”Launches the default browser with the specified URL.
Parameters
Section titled “Parameters”This method has no parameters.
BrowserPreferences type
Section titled “BrowserPreferences type”Namespace
Section titled “Namespace”Trimble.ID.Desktop
Summary
Section titled “Summary”Preferences for browser window
Height property
Section titled “Height property”NewWindow property
Section titled “NewWindow property”Width property
Section titled “Width property”X property
Section titled “X property”Y property
Section titled “Y property”LocalhostAuthenticator type
Section titled “LocalhostAuthenticator type”Namespace
Section titled “Namespace”Trimble.ID.Desktop
Summary
Section titled “Summary”An authenticator that utilizes a localhost callback
Example
Section titled “Example”const string CONFIGURATION_ENDPOINT = "https://id.trimble.com/.well-known/openid-configuration";const string CLIENT_ID = "APPLICATION_CLIENT_ID";var string SCOPES = new [] { "CSharpSDKTesting" };IEndpointProvider endpointProvider = new OpenIdEndpointProvider(new Uri(CONFIGURATION_URL, UriKind.Absolute));IAuthenticator authenticator = new LocalhostAuthenticator(endpointProvider, CLIENT_ID, SCOPES);if (await authenticator.Login()){ var userInfo = await authenticator.GetUserInfo(); var token = await authenticator.TokenProvider.RetrieveToken();}await authenticator.Logout(singleSignOut: true);authenticator.Dispose();Remarks
Section titled “Remarks”Implements IAuthenticator
#ctor(endpointProvider,consumerKey,scopes,productName) constructor
Section titled “#ctor(endpointProvider,consumerKey,scopes,productName) constructor”Summary
Section titled “Summary”Public constructor for LocalhostAuthenticator class
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| endpointProvider | Trimble.ID.IEndpointProvider | An endpoint provider that provides the URL for the Trimble Identity authorization and token endpoints |
| consumerKey | System.String | The consumer key for the calling application |
| scopes | System.String[] | The scopes used in the authorization request, openid is specified by default |
| productName | System.String | The product name of the consuming application (optional). |
IsLoggedIn property
Section titled “IsLoggedIn property”Summary
Section titled “Summary”Get the logged in state
LegacyTokenProvider property
Section titled “LegacyTokenProvider property”Summary
Section titled “Summary”Get the token provider for this authenticator
Remarks
Section titled “Remarks”This token provider can be used with other SDK components
TokenProvider property
Section titled “TokenProvider property”Summary
Section titled “Summary”Get the token provider for this authenticator
Remarks
Section titled “Remarks”This token provider can be used with other SDK components
Dispose() method
Section titled “Dispose() method”Summary
Section titled “Summary”Finalizer for the authenticator
Parameters
Section titled “Parameters”This method has no parameters.
Dispose() method
Section titled “Dispose() method”Summary
Section titled “Summary”Dispose the authenticator
Parameters
Section titled “Parameters”This method has no parameters.
GetUserInfo() method
Section titled “GetUserInfo() method”Summary
Section titled “Summary”Validates the ID token and returns user claims
Returns
Section titled “Returns”User claims from the ID token
Parameters
Section titled “Parameters”This method has no parameters.
LoadCachedLogin() method
Section titled “LoadCachedLogin() method”Summary
Section titled “Summary”Initialize the authenticator with a stored refresh token
Returns
Section titled “Returns”true if the authenticator was initialzed with an existing refresh token
Parameters
Section titled “Parameters”This method has no parameters.
Login(silent,timeoutInMs,cancellationToken) method
Section titled “Login(silent,timeoutInMs,cancellationToken) method”Summary
Section titled “Summary”Log the user in
Returns
Section titled “Returns”true if the user was successfully logged in
Parameters
Section titled “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 | The optional cancellation token. |
Exceptions
Section titled “Exceptions”| Name | Description |
|---|---|
| System.TimeoutException | Login operation has timed out after waiting for specified time. |
| System.Threading.Tasks.TaskCanceledException | Task is canceled when cancellation token is requested and the operation might takes longer time to respond |
Remarks
Section titled “Remarks”Only one login or logout operation is permitted at a time, all previously started operations will return false
Logout(singleSignOut,cancellationToken) method
Section titled “Logout(singleSignOut,cancellationToken) method”Summary
Section titled “Summary”Log the user out
Returns
Section titled “Returns”true if the user was successfully logged out
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| singleSignOut | System.Boolean | true if the single sign in session should be terminated |
| cancellationToken | System.Threading.CancellationToken | The optional cancellation token. |
Exceptions
Section titled “Exceptions”| Name | Description |
|---|---|
| System.Threading.Tasks.TaskCanceledException | Task is canceled when cancellation token is requested and the operation might takes longer time to respond |
Remarks
Section titled “Remarks”Only one login or logout operation is permitted at a time, all previously started operations will return false
WithBrowserPreferences(preferences) method
Section titled “WithBrowserPreferences(preferences) method”Summary
Section titled “Summary”Fluent method to specify browser preferences
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| preferences | Trimble.ID.Desktop.BrowserPreferences | The browser preferences |
WithFixedPort(port) method
Section titled “WithFixedPort(port) method”Summary
Section titled “Summary”Fluent method to specify an alternative port
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| port | System.Int32 | The alternative port to use for the localhost listener |
WithLoopbackAddress(address) method
Section titled “WithLoopbackAddress(address) method”Summary
Section titled “Summary”Fluent method to specify an alternative host
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| address | System.String | The alternative host to use for the localhost listener |
WithOfflineAccess() method
Section titled “WithOfflineAccess() method”Summary
Section titled “Summary”Fluent method to enable offline access.
Returns
Section titled “Returns”The authenticator configured for offline access.
Parameters
Section titled “Parameters”This method has no parameters.
Remarks
Section titled “Remarks”This allows the application to access user’s data and token even when offline. Note that even in offline mode, at least one initial sign-in is required to initialize the token from the cache.
WithPersistentStorage(persistentStorage) method
Section titled “WithPersistentStorage(persistentStorage) method”Summary
Section titled “Summary”Fluent method to specify persistent storage option.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| persistentStorage | Trimble.ID.IPersistantStorage | The persistent storage for refresh tokens |
LocalhostListener type
Section titled “LocalhostListener type”Namespace
Section titled “Namespace”Trimble.ID.Desktop
Summary
Section titled “Summary”A class that listens for HTTP requests on the localhost.
#ctor(address) constructor
Section titled “#ctor(address) constructor”Summary
Section titled “Summary”Constructor for localhost listener
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| address | System.String | The host address to listen on, default 127.0.0.1 |
ANY_PORT constants
Section titled “ANY_PORT constants”LOOPBACK_ADDRESS constants
Section titled “LOOPBACK_ADDRESS constants”Address property
Section titled “Address property”Port property
Section titled “Port property”Dispose() method
Section titled “Dispose() method”Summary
Section titled “Summary”Dispose method for LocalhostListener class
Parameters
Section titled “Parameters”This method has no parameters.
Dispose(disposing) method
Section titled “Dispose(disposing) method”Summary
Section titled “Summary”Frees the resources used by the LocalhostListener object.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| disposing | System.Boolean | A boolean value indicating whether the method is being called |
Start(port) method
Section titled “Start(port) method”Summary
Section titled “Summary”Start a listener on the specified port
Returns
Section titled “Returns”true on success
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| port | System.Int32 | The port to start the listener on, or ANY_PORT |
TokenProviderWrapper type
Section titled “TokenProviderWrapper type”Namespace
Section titled “Namespace”Trimble.ID.Desktop.LocalhostAuthenticator
RetrieveToken() method
Section titled “RetrieveToken() method”Summary
Section titled “Summary”Retrieves the access token.
Returns
Section titled “Returns”The access token.
Parameters
Section titled “Parameters”This method has no parameters.
Exceptions
Section titled “Exceptions”| Name | Description |
|---|---|
| System.InvalidOperationException | Thrown when the user is not logged in. |
| Trimble.ID.TokenRefreshException | Thrown when the token failed to refresh. |
RetrieveTokenAsync(cancellationToken) method
Section titled “RetrieveTokenAsync(cancellationToken) method”Summary
Section titled “Summary”Retrieves the access token.
Returns
Section titled “Returns”An AccessToken which can be used to authenticate service client calls.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| cancellationToken | System.Threading.CancellationToken | A CancellationToken controlling the request lifetime. |
Exceptions
Section titled “Exceptions”| Name | Description |
|---|---|
| System.InvalidOperationException | Thrown when the user is not logged in. |
| Trimble.ID.TokenRefreshException | Thrown when the token failed to refresh. |