Trimble.ID.Maui
Trimble.ID.Maui
Section titled “Trimble.ID.Maui”Contents
Section titled “Contents”IBrowser type
Section titled “IBrowser type”Namespace
Section titled “Namespace”Trimble.ID.Maui
Summary
Section titled “Summary”Represents a browser interface.
Close() method
Section titled “Close() method”Summary
Section titled “Summary”Closes the browser.
Parameters
Section titled “Parameters”This method has no parameters.
Launch(uri) method
Section titled “Launch(uri) method”Summary
Section titled “Summary”Launches the specified URI in the browser.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| uri | System.Uri | The URI to launch. |
IMobileAuthenticator type
Section titled “IMobileAuthenticator type”Namespace
Section titled “Namespace”Trimble.ID.Maui
Summary
Section titled “Summary”Represents an interface for a mobile authenticator that exchanges authorization code for tokens.
OnReceive(query) method
Section titled “OnReceive(query) method”Summary
Section titled “Summary”Exchanges authorization code for tokens.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| query | System.String | Query string that contains state and authorization code. |
OnReceive(state,code) method
Section titled “OnReceive(state,code) method”Summary
Section titled “Summary”Exchanges authorization code for tokens.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| state | System.String | The state parameter. |
| code | System.String | The authorization code. |
MobileAuthenticator type
Section titled “MobileAuthenticator type”Namespace
Section titled “Namespace”Trimble.ID.Maui
Summary
Section titled “Summary”An authenticator that utilizes a custom URI callback
Example
Section titled “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
Section titled “Remarks”Implements IAuthenticator
#ctor(mobileAuthenticatorOptions) constructor
Section titled “#ctor(mobileAuthenticatorOptions) constructor”Summary
Section titled “Summary”Public constructor for MobileAuthenticator class
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| mobileAuthenticatorOptions | Trimble.ID.Maui.MobileAuthenticatorOptions | The options for configuring the authenticator |
#ctor(endpointProvider,clientId,scopes,redirectUri,allowPersistenceStorage) constructor
Section titled “#ctor(endpointProvider,clientId,scopes,redirectUri,allowPersistenceStorage) constructor”Summary
Section titled “Summary”Public constructor for MobileAuthenticator 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 |
| 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
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
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.
Login(silent,timeoutInMs) method
Section titled “Login(silent,timeoutInMs) 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.Thedefault timeout value is 3 minutes. |
Exceptions
Section titled “Exceptions”| Name | Description |
|---|---|
| System.TimeoutException | Login operation has timed out after waiting for specified time. |
Remarks
Section titled “Remarks”Only one login or logout operation is permitted at a time, all previously started operations will return false
Logout(singleSignOut) method
Section titled “Logout(singleSignOut) 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 |
Remarks
Section titled “Remarks”Only one login or logout operation is permitted at a time, all previously started operations will return false
OnReceive(query) method
Section titled “OnReceive(query) method”Summary
Section titled “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
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| query | System.String | Query string that contains state and authorization code |
OnReceive(state,code) method
Section titled “OnReceive(state,code) method”Summary
Section titled “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
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| state | System.String | state parameter |
| code | System.String | authorization code |
WithActivity(activity) method
Section titled “WithActivity(activity) method”Summary
Section titled “Summary”Fluent method to specify current activity
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| activity | Android.App.Activity | Activity that launches the browser during authentication |
MobileAuthenticatorOptions type
Section titled “MobileAuthenticatorOptions type”Namespace
Section titled “Namespace”Trimble.ID.Maui
#ctor() constructor
Section titled “#ctor() constructor”Summary
Section titled “Summary”Initializes a new instance of the MobileAuthenticatorOptions class
Parameters
Section titled “Parameters”This constructor has no parameters.
Remarks
Section titled “Remarks”Contains the options for configuring the authenticator
ClientId property
Section titled “ClientId property”Summary
Section titled “Summary”Gets or sets the client ID (required).
EnableTokenPersistence property
Section titled “EnableTokenPersistence property”Summary
Section titled “Summary”Gets or sets a value indicating whether token persistence is enabled. By default, this is set to true.
EndpointProvider property
Section titled “EndpointProvider property”Summary
Section titled “Summary”Gets or sets the endpoint provider for the mobile authenticator (required).
RedirectUri property
Section titled “RedirectUri property”Summary
Section titled “Summary”Gets or sets the redirect URI (required).
Scopes property
Section titled “Scopes property”Summary
Section titled “Summary”Gets or sets the scopes (required).
TokenProviderWrapper type
Section titled “TokenProviderWrapper type”Namespace
Section titled “Namespace”Trimble.ID.Maui
RetrieveToken() method
Section titled “RetrieveToken() method”Summary
Section titled “Summary”Retrieve access token
Parameters
Section titled “Parameters”This method has no parameters.