Table of Contents

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

httpContextAccessor IHttpContextAccessor

Reaches the response the culture cookie is written to.

requestLocalizationOptions IOptions<RequestLocalizationOptions>

The host's request localization: its supported UI cultures and its cookie provider.

logger ILogger<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

uiLocales string

Returns

RequestCulture

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

uiLocales string

The request's ui_locales: language tags, space-separated, most preferred first; null when none.

ct CancellationToken

Cancels the work.

Returns

Task

A completed task.