Class DefaultUiLocalesService
- Namespace
- Fdyay.IdentityServer.Services
- Assembly
- Fdyay.IdentityServer.AspNetCore.dll
Duende's default: the first supported ui_locales tag, in ASP.NET Core's request-culture cookie.
public class DefaultUiLocalesService : IUiLocalesService
- Inheritance
-
DefaultUiLocalesService
- Implements
- Inherited Members
Remarks
Duende 8.0.1's DefaultUiLocalesService, measured: the tags are tried in the client's order against
SupportedUICultures, each matched to a culture's name exactly, and the first that
matches is written with MakeCookieValue(RequestCulture) under the cookie provider's name — so a
host that uses request localization opens the login page in the language the client asked for. Without a request, a
cookie provider, or a supported tag, nothing is written.
Constructors
DefaultUiLocalesService(IHttpContextAccessor, IOptions<RequestLocalizationOptions>, ILogger<DefaultUiLocalesService>)
Creates the service, as the container resolves it.
public DefaultUiLocalesService(IHttpContextAccessor httpContextAccessor, IOptions<RequestLocalizationOptions> requestLocalizationOptions, ILogger<DefaultUiLocalesService> logger)
Parameters
httpContextAccessorIHttpContextAccessorReaches the response the culture cookie is written to.
requestLocalizationOptionsIOptions<RequestLocalizationOptions>The host's request localization: its supported UI cultures and its cookie provider.
loggerILogger<DefaultUiLocalesService>Receives why nothing was written.
Methods
GetFirstSupportedCulture(string?)
The first tag in uiLocales that is a supported UI culture, or null.
protected virtual RequestCulture? GetFirstSupportedCulture(string? uiLocales)
Parameters
uiLocalesstring
Returns
StoreUiLocalesForRedirectAsync(string?, CancellationToken)
Writes the first tag of uiLocales that is a supported UI culture to the request-culture cookie,
so the interaction page opens in that language; writes nothing when there is no request, no cookie provider, or no
supported tag.
public virtual Task StoreUiLocalesForRedirectAsync(string? uiLocales, CancellationToken ct)
Parameters
uiLocalesstringThe request's
ui_locales: language tags, space-separated, most preferred first; null when none.ctCancellationTokenCancels the work.
Returns
- Task
A completed task.