Trimble.ID.Maui
Trimble.ID.Maui
Contents
IBrowser type
Namespace
Trimble.ID.Maui
Summary
Represents a browser interface.
Close() method
Summary
Closes the browser.
Parameters
This method has no parameters.
Launch(uri) method
Summary
Launches the specified URI in the browser.
Parameters
| Name | Type | Description |
|---|---|---|
| uri | System.Uri | The URI to launch. |
IMobileAuthenticator type
Namespace
Trimble.ID.Maui
Summary
Represents an interface for a mobile authenticator that exchanges authorization code for tokens.
OnReceive(query) method
Summary
Exchanges authorization code for tokens.
Parameters
| Name | Type | Description |
|---|---|---|
| query | System.String | Query string that contains state and authorization code. |
OnReceive(state,code) method
Summary
Exchanges authorization code for tokens.
Parameters
| Name | Type | Description |
|---|---|---|
| state | System.String | The state parameter. |
| code | System.String | The authorization code. |
MobileAuthenticator type
Namespace
Trimble.ID.Maui
Summary
An authenticator that utilizes a custom URI callback
Example
const string CONFIGURATION_ENDPOINT = "https://id.trimble.com/.well-known/openid-configuration";var endpointProvider = new OpenIdEndpointProvider(new Uri(CONFIGURATION_URL, UriKind.Absolute));const string CLIENT_ID = "CLIENT_ID";var string SCOPES = new [] { "SCOPE" };var REDIRECT_URI = "REDIRECT_URI";var options = new MobileAuthenticatorOptions{ EndpointProvider = endpointProvider, ClientId = CLIENT_ID, Scopes = SCOPES,#if WINDOWS RedirectUri = LOCALHOST_REDIRECT_URI,#else RedirectUri = REDIRECT_URI,#endif EnableTokenPersistence = true};var authenticator = new MobileAuthenticator(options);if (await authenticator.Login()){ var userInfo = await authenticator.GetUserInfo(); var token = await authenticator.TokenProvider.RetrieveToken();}await authenticator.Logout(singleSignOut: true);Remarks
Implements IAuthenticator
#ctor(mobileAuthenticatorOptions) constructor
Summary
Public constructor for MobileAuthenticator class
Parameters
| Name | Type | Description |
|---|---|---|
| mobileAuthenticatorOptions | Trimble.ID.Maui.MobileAuthenticatorOptions | The options for configuring the authenticator |
#ctor(endpointProvider,clientId,scopes,redirectUri,allowPersistenceStorage) constructor
Summary
Public constructor for MobileAuthenticator 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 clientId of the calling application |
| scopes | System.String[] | The scopes used in the authorization request |
| redirectUri | System.String | The custom redirect URI scheme used for this authenticator |
| allowPersistenceStorage | System.Boolean | The allowPersistence helps to retrieve cached tokens on network calls. By default it is set to true. If false, no caching is done |
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) 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.Thedefault timeout value is 3 minutes. |
Exceptions
| Name | Description |
|---|---|
| System.TimeoutException | Login operation has timed out after waiting for specified time. |
Remarks
Only one login or logout operation is permitted at a time, all previously started operations will return false
Logout(singleSignOut) 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 |
Remarks
Only one login or logout operation is permitted at a time, all previously started operations will return false
OnReceive(query) method
Summary
Exchanges authorization code for tokens. This method is used in iOS and needs to be invoked to complete Login/Logout from the AppDelegate class.
Parameters
| Name | Type | Description |
|---|---|---|
| query | System.String | Query string that contains state and authorization code |
OnReceive(state,code) method
Summary
Exchanges authorization code for tokens. This method is used in Android and needs to be invoked to complete Login/Logout flow from the Activity that handles application redirect.
Parameters
| Name | Type | Description |
|---|---|---|
| state | System.String | state parameter |
| code | System.String | authorization code |
WithActivity(activity) method
Summary
Fluent method to specify current activity
Parameters
| Name | Type | Description |
|---|---|---|
| activity | Android.App.Activity | Activity that launches the browser during authentication |
MobileAuthenticatorOptions type
Namespace
Trimble.ID.Maui
#ctor() constructor
Summary
Initializes a new instance of the MobileAuthenticatorOptions class
Parameters
This constructor has no parameters.
Remarks
Contains the options for configuring the authenticator
ClientId property
Summary
Gets or sets the client ID (required).
EnableTokenPersistence property
Summary
Gets or sets a value indicating whether token persistence is enabled. By default, this is set to true.
EndpointProvider property
Summary
Gets or sets the endpoint provider for the mobile authenticator (required).
RedirectUri property
Summary
Gets or sets the redirect URI (required).
Scopes property
Summary
Gets or sets the scopes (required).
TokenProviderWrapper type
Namespace
Trimble.ID.Maui
RetrieveToken() method
Summary
Retrieve access token
Parameters
This method has no parameters.