Class BaseAbstractApplicationBuilder<T>
public abstract class BaseAbstractApplicationBuilder<T> where T : BaseAbstractApplicationBuilder<T>
Type Parameters
T
- Inheritance
-
BaseAbstractApplicationBuilder<T>
- Derived
- Inherited Members
Methods
WithClientName(string)
Sets the name of the calling SDK API for telemetry purposes.
public T WithClientName(string clientName)
Parameters
clientNamestringThe name of the SDK API for telemetry purposes.
Returns
- T
WithClientVersion(string)
Sets the version of the calling SDK for telemetry purposes.
public T WithClientVersion(string clientVersion)
Parameters
clientVersionstringThe version of the calling SDK for telemetry purposes.
Returns
- T
WithDebugLoggingCallback(LogLevel, bool, bool)
Sets the Debug logging callback to a default debug method which displays the level of the message and the message itself. For details see https://aka.ms/msal-net-logging
public T WithDebugLoggingCallback(LogLevel logLevel = LogLevel.Info, bool enablePiiLogging = false, bool withDefaultPlatformLoggingEnabled = false)
Parameters
logLevelLogLevelDesired level of logging. The default is LogLevel.Info
enablePiiLoggingboolBoolean used to enable/disable logging of Personally Identifiable Information (PII). PII logs are never written to default outputs like Console, Logcat or NSLog Default is set to
false, which ensures that your application is compliant with GDPR. You can set it totruefor advanced debugging requiring PIIwithDefaultPlatformLoggingEnabledboolFlag to enable/disable logging to platform defaults. In Desktop, Event Tracing is used. In iOS, NSLog is used. In android, logcat is used. The default value is
false
Returns
- T
The builder to chain the .With methods
Exceptions
- See Also
WithExperimentalFeatures(bool)
Allows usage of experimental features and APIs. If this flag is not set, experimental features will throw an exception. For details see https://aka.ms/msal-net-experimental-features
public T WithExperimentalFeatures(bool enableExperimentalFeatures = true)
Parameters
enableExperimentalFeaturesbool
Returns
- T
Remarks
Changes in the public API of experimental features will not result in an increment of the major version of this library. For these reason we advise against using these features in production.
WithHttpClientFactory(IMsalHttpClientFactory)
Uses a specific IMsalHttpClientFactory to communicate with the IdP. This enables advanced scenarios such as setting a proxy, or setting the Agent.
public T WithHttpClientFactory(IMsalHttpClientFactory httpClientFactory)
Parameters
httpClientFactoryIMsalHttpClientFactoryHTTP client factory
Returns
- T
The builder to chain the .With methods
Remarks
MSAL does not guarantee that it will not modify the HttpClient, for example by adding new headers. Prior to the changes needed in order to make MSAL's httpClients thread safe (https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/pull/2046/files), the httpClient had the possibility of throwing an exception stating "Properties can only be modified before sending the first request". MSAL's httpClient will no longer throw this exception after 4.19.0 (https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/releases/tag/4.19.0) see (https://aka.ms/msal-httpclient-info) for more information.
WithHttpClientFactory(IMsalHttpClientFactory, bool)
Uses a specific IMsalHttpClientFactory to communicate with the IdP. This enables advanced scenarios such as setting a proxy, or setting the Agent.
public T WithHttpClientFactory(IMsalHttpClientFactory httpClientFactory, bool retryOnceOn5xx)
Parameters
httpClientFactoryIMsalHttpClientFactoryHTTP client factory
retryOnceOn5xxboolConfigures MSAL to retry on 5xx server errors. When enabled (on by default), MSAL will wait 1 second after receiving a 5xx error and then retry the http request again.
Returns
- T
The builder to chain the .With methods
Remarks
MSAL does not guarantee that it will not modify the HttpClient, for example by adding new headers. Prior to the changes needed in order to make MSAL's httpClients thread safe (https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/pull/2046/files), the httpClient had the possibility of throwing an exception stating "Properties can only be modified before sending the first request". MSAL's httpClient will no longer throw this exception after 4.19.0 (https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/releases/tag/4.19.0) see (https://aka.ms/msal-httpclient-info) for more information. If you only want to configure the retryOnceOn5xx parameter, set httpClientFactory to null and MSAL will use the default http client.
WithLogging(LogCallback, LogLevel?, bool?, bool?)
Sets the logging callback. For details see https://aka.ms/msal-net-logging
public T WithLogging(LogCallback loggingCallback, LogLevel? logLevel = null, bool? enablePiiLogging = null, bool? enableDefaultPlatformLogging = null)
Parameters
loggingCallbackLogCallbacklogLevelLogLevel?Desired level of logging. The default is LogLevel.Info
enablePiiLoggingbool?Boolean used to enable/disable logging of Personally Identifiable Information (PII). PII logs are never written to default outputs like Console, Logcat or NSLog Default is set to
false, which ensures that your application is compliant with GDPR. You can set it totruefor advanced debugging requiring PII If both WithLogging apis are set, the other one will override the this oneenableDefaultPlatformLoggingbool?Flag to enable/disable logging to platform defaults. In Desktop, Event Tracing is used. In iOS, NSLog is used. In android, Logcat is used. The default value is
false
Returns
- T
The builder to chain the .With methods
Exceptions
WithLogging(IIdentityLogger, bool)
Sets the Identity Logger. For details see https://aka.ms/msal-net-logging
public T WithLogging(IIdentityLogger identityLogger, bool enablePiiLogging = false)
Parameters
identityLoggerIIdentityLoggerIdentityLogger
enablePiiLoggingboolBoolean used to enable/disable logging of Personally Identifiable Information (PII). PII logs are never written to default outputs like Console, Logcat or NSLog Default is set to
false, which ensures that your application is compliant with GDPR. You can set it totruefor advanced debugging requiring PII If both WithLogging apis are set, this one will override the other
Returns
- T
The builder to chain the .With methods
WithOptions(BaseApplicationOptions)
Sets application options, which can, for instance have been read from configuration files. See https://aka.ms/msal-net-application-configuration.
protected T WithOptions(BaseApplicationOptions applicationOptions)
Parameters
applicationOptionsBaseApplicationOptionsApplication options
Returns
- T
The builder to chain the .With methods