Ditto 4.13.1
Loading...
Searching...
No Matches
DittoSDK.DittoAuthenticationProvider Struct Reference

Represents a string-based authentication provider identifier used for login with Ditto. More...

Public Member Functions

 DittoAuthenticationProvider (string rawValue)
 Initializes a new instance of the DittoAuthenticationProvider struct given the provider string value.
override string ToString ()
bool Equals (DittoAuthenticationProvider other)
override bool Equals (object obj)
override int GetHashCode ()

Static Public Member Functions

static DittoAuthenticationProvider Custom (string rawValue)
 Creates a custom authentication provider using the given raw string value.
static implicit operator string (DittoAuthenticationProvider provider)
static bool operator== (DittoAuthenticationProvider left, DittoAuthenticationProvider right)
static bool operator!= (DittoAuthenticationProvider left, DittoAuthenticationProvider right)

Properties

static DittoAuthenticationProvider Development [get]
 Gets the built-in development authentication provider to be used together with development authentication tokens.
string RawValue [get]
 Gets the raw string value representing the authentication provider.

Detailed Description

Represents a string-based authentication provider identifier used for login with Ditto.

This struct defines built-in providers such as Development, and also allows defining custom providers by passing an arbitrary string to Custom(string) or by using the constructor.

Important: This API is in preview and provides a type-safe struct for specifying authentication providers, using the extensible-enum pattern. Supports both built-in and custom providers in a consistent and ergonomic way in v5.

Custom providers can be defined as follows:

var provider = DittoAuthenticationProvider.Custom("my-custom-provider");
await ditto.Auth.LoginAsync(token, provider);
DittoAuthenticationProvider(string rawValue)
Initializes a new instance of the DittoAuthenticationProvider struct given the provider string value.
Definition DittoAuthenticationProvider.cs:58

Constructor & Destructor Documentation

◆ DittoAuthenticationProvider()

DittoSDK.DittoAuthenticationProvider.DittoAuthenticationProvider ( string rawValue)
inline

Initializes a new instance of the DittoAuthenticationProvider struct given the provider string value.

Parameters
rawValueThe provider string used in authentication requests.
Exceptions
ArgumentNullExceptionThrown if rawValue is null.
ArgumentExceptionThrown if rawValue is empty or contains only whitespace.

Member Function Documentation

◆ Custom()

DittoAuthenticationProvider DittoSDK.DittoAuthenticationProvider.Custom ( string rawValue)
static

Creates a custom authentication provider using the given raw string value.

Parameters
rawValueThe string identifier for the custom provider.
Returns
A DittoAuthenticationProvider representing the custom provider.