Path: redb/redb.Templates/templates/redb-identity-app/RedbIdentityApp.Web/Auth/WebIdentityOptions.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Templates/templates/redb-identity-app/RedbIdentityApp.Web/Auth/WebIdentityOptions.cs
----
namespace RedbIdentityApp.Web.Auth;
/// The Identity section of appsettings.json: where users sign in, and as which client.
public sealed class WebIdentityOptions
{
/// Identity's issuer, an https address. The browser and this server both reach it there.
public string Authority { get; set; } = "";
/// This server's client; the module creates it at Identity (Identity:WebClientId of the module).
public string ClientId { get; set; } = "";
/// The client's secret, the same value as the module's Identity:WebClientSecret. Environment only.
public string ClientSecret { get; set; } = "";
/// The scope that lets the access token call the module's API.
public string ApiScope { get; set; } = "";
/// The administrative scope; Identity grants it to administrators only and drops it for others.
public string AdminScope { get; set; } = "";
///
/// Development only: accept any certificate from Identity, for the self-signed one of the
/// redb-identity-full image on your machine. Refused outside the Development environment; a container
/// trusts that certificate through its CA store instead (Dockerfile).
///
public bool AcceptAnyServerCertificate { get; set; }
public void Validate(IHostEnvironment environment)
{
if (!Uri.TryCreate(Authority, UriKind.Absolute, out var authority) || authority.Scheme != Uri.UriSchemeHttps)
throw new InvalidOperationException("Identity:Authority must be the https address of redb.Identity.");
if (string.IsNullOrWhiteSpace(ClientId) || string.IsNullOrWhiteSpace(ApiScope) || string.IsNullOrWhiteSpace(AdminScope))
throw new InvalidOperationException("Identity:ClientId, Identity:ApiScope and Identity:AdminScope are required.");
if (ClientSecret.Length < 32)
throw new InvalidOperationException("Identity:ClientSecret is missing or shorter than 32 characters: set Identity__ClientSecret.");
if (AcceptAnyServerCertificate && !environment.IsDevelopment())
throw new InvalidOperationException("Identity:AcceptAnyServerCertificate is for the Development environment only.");
}
}