dymaptic.GeoBlazor.Core

dymaptic.GeoBlazor.Core.Model

AuthenticationManager Class

Manager for all authentication-related tasks, tokens, and keys

public class AuthenticationManager

Inheritance System.Object 🡒 AuthenticationManager

Constructors

AuthenticationManager(IJSRuntime, JsModuleManager, IConfiguration) Constructor

Default Constructor

public AuthenticationManager(Microsoft.JSInterop.IJSRuntime jsRuntime, dymaptic.GeoBlazor.Core.JsModuleManager jsModuleManager, Microsoft.Extensions.Configuration.IConfiguration configuration);

Parameters

jsRuntime Microsoft.JSInterop.IJSRuntime

Injected JavaScript Runtime reference

jsModuleManager JsModuleManager

Injected JavaScript Module Manager reference

configuration Microsoft.Extensions.Configuration.IConfiguration

Injected configuration object

Properties

AuthenticationManager.ApiKey Property

Get or set the ArcGIS Application Api Key.

public string? ApiKey { get; set; }

Property Value

System.String

AuthenticationManager.AppId Property

Get or set the OAuth App ID.

public string? AppId { get; set; }

Property Value

System.String

AuthenticationManager.FontsUrl Property

Get or set the ArcGIS Fonts URL. This would only be used in disconnected scenarios where you want to point to a local ArcGIS Portal.

public string? FontsUrl { get; set; }

Property Value

System.String

AuthenticationManager.PortalUrl Property

The ArcGIS Enterprise Portal URL, only required if using Enterprise authentication.

public string? PortalUrl { get; set; }

Property Value

System.String

AuthenticationManager.TokenExpirationDateTime Property

The expiration date and time of the current token. This is used to determine when the token should be refreshed or removed. If the token is an API Key, this will be null.

public System.Nullable<System.DateTime> TokenExpirationDateTime { get; set; }

Property Value

System.Nullable<System.DateTime>

AuthenticationManager.TrustedServers Property

Get or set the ArcGIS Application Trusted Servers.

public System.Collections.Generic.List<string>? TrustedServers { get; set; }

Property Value

System.Collections.Generic.List<System.String>

Methods

AuthenticationManager.EnsureLoggedIn() Method

Ensures that the user is logged in. If not, it will attempt to log them in.

public System.Threading.Tasks.Task EnsureLoggedIn();

Returns

System.Threading.Tasks.Task

AuthenticationManager.GetArcGisJsInterop() Method

Retrieves the correct copy of the ArcGisJsInterop based on the nuget package

public System.Threading.Tasks.Task<Microsoft.JSInterop.IJSObjectReference> GetArcGisJsInterop();

Returns

System.Threading.Tasks.Task<Microsoft.JSInterop.IJSObjectReference>

AuthenticationManager.GetCurrentToken() Method

Provides an implementation-agnostic way to fetch the current authentication token, whether it’s an OAuth token or an API Key

public System.Threading.Tasks.Task<string?> GetCurrentToken();

Returns

System.Threading.Tasks.Task<System.String>

AuthenticationManager.GetTokenExpirationDateTime() Method

Retrieves the expiration date and time of the current token. This is used to determine when the token should be refreshed or removed. If the token is an API Key, this will always return null.

public System.Threading.Tasks.Task<System.Nullable<System.DateTime>> GetTokenExpirationDateTime();

Returns

System.Threading.Tasks.Task<System.Nullable<System.DateTime>>

AuthenticationManager.Initialize() Method

Initializes authentication based on either an OAuth App ID or an API Key. This is called automatically by MapView on first render, but can also be called manually for other actions such as rest calls.

public System.Threading.Tasks.Task<bool> Initialize();

Returns

System.Threading.Tasks.Task<System.Boolean>

AuthenticationManager.IsLoggedIn() Method

Tests to see if the user is logged in. True if yes, false if otherwise.

public System.Threading.Tasks.Task<bool> IsLoggedIn();

Returns

System.Threading.Tasks.Task<System.Boolean>
Returns a boolean value indicating whether or not the user is logged in.

AuthenticationManager.Login() Method

Initiates an OAuth login flow

public System.Threading.Tasks.Task Login();

Returns

System.Threading.Tasks.Task

AuthenticationManager.RegisterToken(string, DateTimeOffset) Method

Registers the given OAuth 2.0 access token or ArcGIS Server token with the AuthenticationManager. The RegisterToken method is an advanced workflow for pre-registering long-term tokens for when you don’t want users to sign in. See App Authentication for more information.

public System.Threading.Tasks.Task RegisterToken(string token, System.DateTimeOffset expires);

Parameters

token System.String

The access token.

expires System.DateTimeOffset

The expiration date and time of the token. This is used to determine when the token should be refreshed or removed.

Returns

System.Threading.Tasks.Task