Skip to content

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
NameTypeDescription
uriSystem.UriThe 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
NameTypeDescription
querySystem.StringQuery string that contains state and authorization code.

OnReceive(state,code) method

Summary

Exchanges authorization code for tokens.

Parameters
NameTypeDescription
stateSystem.StringThe state parameter.
codeSystem.StringThe 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
NameTypeDescription
mobileAuthenticatorOptionsTrimble.ID.Maui.MobileAuthenticatorOptionsThe options for configuring the authenticator

#ctor(endpointProvider,clientId,scopes,redirectUri,allowPersistenceStorage) constructor

Summary

Public constructor for MobileAuthenticator class

Parameters
NameTypeDescription
endpointProviderTrimble.ID.IEndpointProviderAn endpoint provider that provides the URL for the Trimble Identity authorization and token endpoints
clientIdSystem.StringThe clientId of the calling application
scopesSystem.String[]The scopes used in the authorization request
redirectUriSystem.StringThe custom redirect URI scheme used for this authenticator
allowPersistenceStorageSystem.BooleanThe 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
NameTypeDescription
silentSystem.Booleantrue if no UI should be shown i.e. prompt=none
timeoutInMsSystem.Int32Specify the length of time that client waits for a login response when making a login attempt.Thedefault timeout value is 3 minutes.
Exceptions
NameDescription
System.TimeoutExceptionLogin 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
NameTypeDescription
singleSignOutSystem.Booleantrue 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
NameTypeDescription
querySystem.StringQuery 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
NameTypeDescription
stateSystem.Stringstate parameter
codeSystem.Stringauthorization code

WithActivity(activity) method

Summary

Fluent method to specify current activity

Parameters
NameTypeDescription
activityAndroid.App.ActivityActivity 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.