Bundle: redb-identity / src/redb.Identity.Client (src.redb.Identity.Client.txt), 42 files Snapshot: 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-identity Index: https://redbase.app/src/dev-2026-12-06/redb-identity/_index.txt ==== Path: redb-identity/src/redb.Identity.Client/ApiException.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/ApiException.cs ---- using System.Net; namespace redb.Identity.Client; /// /// Thrown by Identity client methods when the server returns a non-success HTTP status. /// Carries the status code, parsed RFC 7807 problem details (when available) and the raw body. /// public sealed class ApiException : Exception { public HttpStatusCode StatusCode { get; } public ProblemDetails? ProblemDetails { get; } public string? RawBody { get; } public ApiException( HttpStatusCode statusCode, string message, ProblemDetails? problemDetails = null, string? rawBody = null, Exception? inner = null) : base(message, inner) { StatusCode = statusCode; ProblemDetails = problemDetails; RawBody = rawBody; } } /// RFC 7807 problem details (incl. ASP.NET ValidationProblemDetails.errors). public sealed class ProblemDetails { public string? Type { get; set; } public string? Title { get; set; } public int? Status { get; set; } public string? Detail { get; set; } public string? Instance { get; set; } /// Per-field validation errors (for ASP.NET ValidationProblemDetails). public Dictionary? Errors { get; set; } /// RFC 7807 extension members (e.g. trace_id, correlation_id). public Dictionary? Extensions { get; set; } } Path: redb-identity/src/redb.Identity.Client/Auth/BearerTokenHandler.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Auth/BearerTokenHandler.cs ---- using System.Net.Http.Headers; namespace redb.Identity.Client.Auth; /// /// that adds Authorization: Bearer <token> /// to outgoing requests. If the configured returns /// null or an empty token, no header is added (anonymous flow allowed). /// public sealed class BearerTokenHandler : DelegatingHandler { private readonly IAccessTokenProvider _tokenProvider; public BearerTokenHandler(IAccessTokenProvider tokenProvider) { _tokenProvider = tokenProvider; } protected override async Task SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) { var token = await _tokenProvider.GetAccessTokenAsync(cancellationToken).ConfigureAwait(false); if (!string.IsNullOrEmpty(token)) { request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); } return await base.SendAsync(request, cancellationToken).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/Auth/ClientCredentialsAccessTokenProvider.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Auth/ClientCredentialsAccessTokenProvider.cs ---- using System.Text.Json; using Microsoft.Extensions.Options; namespace redb.Identity.Client.Auth; /// /// implementation using OAuth2 client_credentials grant. /// Caches the access token until ~1 minute before expiry. Use for CLI / server-to-server /// scenarios. Web should provide its own per-request HttpContext-based provider. /// public sealed class ClientCredentialsAccessTokenProvider : IAccessTokenProvider, IDisposable { private readonly HttpClient _http; private readonly IdentityClientOptions _opts; private readonly AuthorityDiscovery _discovery; private readonly SemaphoreSlim _lock = new(1, 1); private string? _cachedToken; private DateTimeOffset _expiresAt = DateTimeOffset.MinValue; /// /// The token comes from the token_endpoint of the discovery document at /// , not from . /// public ClientCredentialsAccessTokenProvider(HttpClient http, IOptions opts) { _http = http; _opts = opts.Value; _discovery = new AuthorityDiscovery(http, _opts.Authority, ServiceCollectionExtensions.AuthorityOption); } public async Task GetAccessTokenAsync(CancellationToken ct = default) { if (_cachedToken is not null && DateTimeOffset.UtcNow < _expiresAt - TimeSpan.FromMinutes(1)) return _cachedToken; await _lock.WaitAsync(ct).ConfigureAwait(false); try { // Double-check after acquiring lock if (_cachedToken is not null && DateTimeOffset.UtcNow < _expiresAt - TimeSpan.FromMinutes(1)) return _cachedToken; if (string.IsNullOrEmpty(_opts.ClientId) || string.IsNullOrEmpty(_opts.ClientSecret)) throw new InvalidOperationException( "ClientCredentialsAccessTokenProvider requires ClientId+ClientSecret in IdentityClientOptions."); var form = new FormUrlEncodedContent(new[] { new KeyValuePair("grant_type", "client_credentials"), new KeyValuePair("client_id", _opts.ClientId), new KeyValuePair("client_secret", _opts.ClientSecret), new KeyValuePair("scope", string.Join(' ', _opts.Scopes)), }); var tokenEndpoint = await _discovery.GetEndpointAsync("token_endpoint", ct).ConfigureAwait(false); using var resp = await _http.PostAsync(tokenEndpoint, form, ct).ConfigureAwait(false); resp.EnsureSuccessStatusCode(); var json = await resp.Content.ReadAsStringAsync(ct).ConfigureAwait(false); using var doc = JsonDocument.Parse(json); _cachedToken = doc.RootElement.GetProperty("access_token").GetString()!; var expiresIn = doc.RootElement.TryGetProperty("expires_in", out var ei) ? ei.GetInt32() : 3600; _expiresAt = DateTimeOffset.UtcNow.AddSeconds(expiresIn); return _cachedToken; } finally { _lock.Release(); } } public void Dispose() => _lock.Dispose(); } Path: redb-identity/src/redb.Identity.Client/Auth/IAccessTokenProvider.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Auth/IAccessTokenProvider.cs ---- namespace redb.Identity.Client.Auth; /// /// Resolves a bearer access token for outgoing Identity API calls. /// Implementations: /// - HttpContextAccessTokenProvider (in redb.Identity.Web) — reads from cookie session /// - — for CLI / server-to-server /// public interface IAccessTokenProvider { Task GetAccessTokenAsync(CancellationToken ct = default); } Path: redb-identity/src/redb.Identity.Client/Backchannel/BackchannelBearerHandler.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Backchannel/BackchannelBearerHandler.cs ---- using System.Net.Http.Headers; namespace redb.Identity.Client.Backchannel; /// /// that attaches Authorization: Bearer <token> /// using . Separate from /// redb.Identity.Client.Auth.BearerTokenHandler so backchannel and user-context /// clients can coexist in the same DI container. /// internal sealed class BackchannelBearerHandler : DelegatingHandler { private readonly BackchannelTokenProvider _tokens; public BackchannelBearerHandler(BackchannelTokenProvider tokens) { _tokens = tokens; } protected override async Task SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) { var token = await _tokens.GetAccessTokenAsync(cancellationToken).ConfigureAwait(false); if (!string.IsNullOrEmpty(token)) { request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); } return await base.SendAsync(request, cancellationToken).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/Backchannel/BackchannelIdentityClient.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Backchannel/BackchannelIdentityClient.cs ---- using System.Net.Http.Json; using System.Text.Json; using System.Text.Json.Serialization; using Microsoft.Extensions.Options; using redb.Identity.Contracts.Sessions; using redb.Identity.Contracts.Users; namespace redb.Identity.Client.Backchannel; /// /// Default implementation. Owns a typed /// registered via /// . /// public sealed class BackchannelIdentityClient : IBackchannelIdentityClient { private const string BasePath = "/api/v1/identity/revoked-sids"; private const string PasswordBasePath = "/api/v1/identity/password"; private const string AccountVerifyEmailBasePath = "/api/v1/identity/account/verify-email"; private const string AccountChangeEmailBasePath = "/api/v1/identity/account/change-email"; private const string AccountRegisterBasePath = "/api/v1/identity/account/register"; private readonly HttpClient _http; private readonly JsonSerializerOptions _json; public BackchannelIdentityClient(HttpClient http, IOptions opts) { _http = http; var o = opts.Value; _http.BaseAddress ??= o.BaseUrl; _json = new JsonSerializerOptions(JsonSerializerDefaults.Web) { PropertyNameCaseInsensitive = true, Converters = { new JsonStringEnumConverter() } }; } public async Task AddRevokedSidAsync( string? sid, string? sub, string? clientId, DateTimeOffset? expiresAt = null, CancellationToken ct = default) { var request = new RevokedSidsAddRequest { Sid = sid, Sub = sub, ClientId = clientId, ExpiresAt = expiresAt }; using var resp = await _http.PostAsJsonAsync(BasePath, request, _json, ct).ConfigureAwait(false); resp.EnsureSuccessStatusCode(); return (await resp.Content.ReadFromJsonAsync(_json, ct).ConfigureAwait(false))!; } public async Task GetRevokedSidsSinceAsync( DateTimeOffset? cursor = null, CancellationToken ct = default) { var url = cursor.HasValue ? $"{BasePath}/since?cursor={Uri.EscapeDataString(cursor.Value.ToString("O"))}" : $"{BasePath}/since"; using var resp = await _http.GetAsync(url, ct).ConfigureAwait(false); resp.EnsureSuccessStatusCode(); return (await resp.Content.ReadFromJsonAsync(_json, ct).ConfigureAwait(false))!; } public async Task ForgotPasswordAsync( PasswordForgotRequest request, CancellationToken ct = default) { // Anonymous endpoint on the host — the management bearer the typed client carries // is ignored by the anonymous-prefix bypass. Any non-2xx is treated as success at // this layer to preserve the anti-enumeration contract end-to-end. using var resp = await _http.PostAsJsonAsync($"{PasswordBasePath}/forgot", request, _json, ct).ConfigureAwait(false); return new PasswordForgotResponse { Success = true }; } public async Task ResetPasswordAsync( PasswordResetRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{PasswordBasePath}/reset", request, _json, ct).ConfigureAwait(false); if (!resp.IsSuccessStatusCode) { return new PasswordResetResponse { Success = false, Error = "invalid_token", ErrorDescription = "The reset token is invalid or has expired." }; } return (await resp.Content.ReadFromJsonAsync(_json, ct).ConfigureAwait(false)) ?? new PasswordResetResponse { Success = false, Error = "empty_response" }; } public async Task VerifyEmailConfirmAsync( EmailVerifyConfirmRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{AccountVerifyEmailBasePath}/confirm", request, _json, ct).ConfigureAwait(false); if (!resp.IsSuccessStatusCode) { return new EmailVerifyConfirmResponse { Success = false, Error = "invalid_token", ErrorDescription = "The verification token is invalid or has expired." }; } return (await resp.Content.ReadFromJsonAsync(_json, ct).ConfigureAwait(false)) ?? new EmailVerifyConfirmResponse { Success = false, Error = "empty_response" }; } public async Task ChangeEmailConfirmAsync( ChangeEmailConfirmRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{AccountChangeEmailBasePath}/confirm", request, _json, ct).ConfigureAwait(false); if (!resp.IsSuccessStatusCode) { return new ChangeEmailConfirmResponse { Success = false, Error = "invalid_token", ErrorDescription = "The confirmation token is invalid or has expired." }; } return (await resp.Content.ReadFromJsonAsync(_json, ct).ConfigureAwait(false)) ?? new ChangeEmailConfirmResponse { Success = false, Error = "empty_response" }; } public async Task RegisterAccountAsync( RegisterAccountRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(AccountRegisterBasePath, request, _json, ct).ConfigureAwait(false); if (resp.IsSuccessStatusCode) { return (await resp.Content.ReadFromJsonAsync(_json, ct).ConfigureAwait(false)) ?? new RegisterAccountResponse { Success = false, Error = "empty_response" }; } // Structured failure: the host always returns a typed body on rejections; surface // the body verbatim so the BFF can render the actionable error to the user. try { var body = await resp.Content.ReadFromJsonAsync(_json, ct).ConfigureAwait(false); if (body is not null && !string.IsNullOrEmpty(body.Error)) return body; } catch { // Fall through to canonical fallback below. } var fallbackError = resp.StatusCode switch { System.Net.HttpStatusCode.NotFound or System.Net.HttpStatusCode.Forbidden => "registration_disabled", System.Net.HttpStatusCode.Conflict => "duplicate", System.Net.HttpStatusCode.BadRequest => "validation_error", _ => "registration_failed", }; return new RegisterAccountResponse { Success = false, Error = fallbackError, ErrorDescription = $"Account registration failed with HTTP status {(int)resp.StatusCode}.", }; } } Path: redb-identity/src/redb.Identity.Client/Backchannel/BackchannelIdentityClientOptions.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Backchannel/BackchannelIdentityClientOptions.cs ---- namespace redb.Identity.Client.Backchannel; /// /// Configuration for the service-to-service backchannel identity client /// (W6-0). Holds client_credentials creds for the dedicated service /// account that publishes/polls revoked-sids on behalf of a Web BFF. /// public sealed class BackchannelIdentityClientOptions { /// /// Base URL of the Identity management API (/api/v1/identity/*). With /// IdentityTransport:Http:ManagementPort set it is that port; the token does not come from here. /// public Uri BaseUrl { get; set; } = new("https://localhost/"); /// /// Required. The issuer of the Identity server, for example https://id.example.org. The token is requested /// from the token_endpoint that the discovery document at /// {Authority}/.well-known/openid-configuration names, and from nowhere else. The document is read at the /// first token request, not at start-up, and kept for the life of the client; when the server cannot be reached, /// that request fails and the next one reads the document again. /// public Uri? Authority { get; set; } /// Client_id of the backchannel service account. public string ClientId { get; set; } = string.Empty; /// Client_secret of the backchannel service account. public string ClientSecret { get; set; } = string.Empty; /// Scopes requested via client_credentials. Defaults to identity:manage. public string[] Scopes { get; set; } = ["identity:manage"]; /// Per-request timeout. Default 30s. public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(30); } Path: redb-identity/src/redb.Identity.Client/Backchannel/BackchannelServiceCollectionExtensions.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Backchannel/BackchannelServiceCollectionExtensions.cs ---- using System.Net.Http.Headers; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; namespace redb.Identity.Client.Backchannel; /// /// DI extensions for the W6-0 backchannel client. Registers /// as a typed HttpClient backed by a /// dedicated using client_credentials. /// public static class BackchannelServiceCollectionExtensions { internal const string AuthorityOption = "BackchannelIdentityClientOptions.Authority"; /// /// Register the W6-0 backchannel client (). /// Coexists with the regular user-context IIdentityClient registration; the /// two clients use separate instances and separate /// Authorization header pipelines. /// public static IServiceCollection AddBackchannelIdentityClient( this IServiceCollection services, Action configure) { services.AddOptions() .Configure(configure) .Validate(o => o.Authority is { IsAbsoluteUri: true }, AuthorityDiscovery.MissingAuthorityMessage(AuthorityOption)) .ValidateOnStart(); // Token-acquisition HttpClient (no auth header): discovery and the token endpoint are absolute addresses // taken from BackchannelIdentityClientOptions.Authority, not from BaseUrl. services.AddHttpClient((sp, http) => { var o = sp.GetRequiredService>().Value; http.Timeout = o.Timeout; }); services.AddTransient(); services.AddHttpClient((sp, http) => { var o = sp.GetRequiredService>().Value; http.BaseAddress = o.BaseUrl; http.Timeout = o.Timeout; http.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); }) .AddHttpMessageHandler(); return services; } } Path: redb-identity/src/redb.Identity.Client/Backchannel/BackchannelTokenProvider.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Backchannel/BackchannelTokenProvider.cs ---- using System.Text.Json; using Microsoft.Extensions.Options; using redb.Identity.Client.Internal; namespace redb.Identity.Client.Backchannel; /// /// Caches a client_credentials access token for the backchannel client. /// Isolated from the global registration so a /// Web BFF can keep its user-context provider while this one serves machine-context /// requests. The token comes from the token_endpoint of the discovery document at /// . /// internal sealed class BackchannelTokenProvider : IDisposable { private readonly HttpClient _http; private readonly IOptions _opts; private readonly AuthorityDiscovery _discovery; private readonly SemaphoreSlim _lock = new(1, 1); private string? _cachedToken; private DateTimeOffset _expiresAt = DateTimeOffset.MinValue; public BackchannelTokenProvider(HttpClient http, IOptions opts) { _http = http; _opts = opts; _discovery = new AuthorityDiscovery(http, opts.Value.Authority, BackchannelServiceCollectionExtensions.AuthorityOption); } public async Task GetAccessTokenAsync(CancellationToken ct = default) { if (_cachedToken is not null && DateTimeOffset.UtcNow < _expiresAt - TimeSpan.FromMinutes(1)) return _cachedToken; await _lock.WaitAsync(ct).ConfigureAwait(false); try { if (_cachedToken is not null && DateTimeOffset.UtcNow < _expiresAt - TimeSpan.FromMinutes(1)) return _cachedToken; var opts = _opts.Value; if (string.IsNullOrEmpty(opts.ClientId) || string.IsNullOrEmpty(opts.ClientSecret)) throw new InvalidOperationException( "BackchannelTokenProvider requires BackchannelIdentityClientOptions.ClientId and ClientSecret."); var tokenEndpoint = await _discovery.GetEndpointAsync("token_endpoint", ct).ConfigureAwait(false); var form = new FormUrlEncodedContent(new[] { new KeyValuePair("grant_type", "client_credentials"), new KeyValuePair("client_id", opts.ClientId), new KeyValuePair("client_secret", opts.ClientSecret), new KeyValuePair("scope", string.Join(' ', opts.Scopes)), }); using var resp = await _http.PostAsync(tokenEndpoint, form, ct).ConfigureAwait(false); resp.EnsureSuccessStatusCode(); var json = await resp.Content.ReadAsStringAsync(ct).ConfigureAwait(false); using var doc = JsonDocument.Parse(json); _cachedToken = doc.RootElement.GetProperty("access_token").GetString()!; var expiresIn = doc.RootElement.TryGetProperty("expires_in", out var ei) ? ei.GetInt32() : 3600; _expiresAt = DateTimeOffset.UtcNow.AddSeconds(expiresIn); return _cachedToken; } finally { _lock.Release(); } } public void Dispose() => _lock.Dispose(); } Path: redb-identity/src/redb.Identity.Client/Backchannel/IBackchannelIdentityClient.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Backchannel/IBackchannelIdentityClient.cs ---- using redb.Identity.Contracts.Sessions; using redb.Identity.Contracts.Users; namespace redb.Identity.Client.Backchannel; /// /// Narrow service-to-service client for the W6-0 backchannel revoked-sids API. /// Authenticates via client_credentials using credentials supplied through /// and is independent from the /// user-context registration. /// public interface IBackchannelIdentityClient { /// /// Publish a backchannel revocation entry. At least one of /// / must be supplied. /// Task AddRevokedSidAsync( string? sid, string? sub, string? clientId, DateTimeOffset? expiresAt = null, CancellationToken ct = default); /// /// Incremental poll. Omit for the first call (server /// returns a baseline window of size RevokedSidsMaxRetention); on /// subsequent calls pass . /// Task GetRevokedSidsSinceAsync( DateTimeOffset? cursor = null, CancellationToken ct = default); /// /// N-4 (Session C): proxy the anonymous password-recovery initiation to the Identity /// host. Always succeeds from the caller's perspective per the anti-enumeration /// contract — callers MUST NOT branch on the return value to leak account existence. /// Task ForgotPasswordAsync( PasswordForgotRequest request, CancellationToken ct = default); /// /// N-4 (Session C): proxy the anonymous password-reset consumption to the Identity /// host. Returns the structured response so the BFF UI can distinguish /// invalid_token / weak_password / success. /// Task ResetPasswordAsync( PasswordResetRequest request, CancellationToken ct = default); /// /// N4-6: proxy the anonymous e-mail-verification confirmation to the Identity host. /// Returns the structured response collapsed to a generic invalid_token on /// any non-2xx outcome — mirrors . /// Task VerifyEmailConfirmAsync( EmailVerifyConfirmRequest request, CancellationToken ct = default); /// /// N4-7: proxy the anonymous change-of-e-mail confirmation to the Identity host. /// Returns the structured response collapsed to a generic invalid_token on any /// non-2xx outcome — mirrors . /// Task ChangeEmailConfirmAsync( ChangeEmailConfirmRequest request, CancellationToken ct = default); /// /// N-3 (sub-step N3-7): proxy the anonymous self-service account registration to the /// Identity host. Returns the structured response verbatim — unlike /// the registration surface is NOT anti-enumeration, /// so failure codes (duplicate / weak_password / validation_error / /// registration_disabled) propagate to the caller so the UI can render actionable /// messages. /// Task RegisterAccountAsync( RegisterAccountRequest request, CancellationToken ct = default); } Path: redb-identity/src/redb.Identity.Client/GlobalUsings.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/GlobalUsings.cs ---- global using System.Net.Http.Json; global using redb.Identity.Client.Internal; Path: redb-identity/src/redb.Identity.Client/IIdentityClient.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IIdentityClient.cs ---- namespace redb.Identity.Client; /// /// Single facade for Identity HTTP API (admin / account / token / scim). /// Methods are grouped by domain into partial interface files /// (IIdentityClient.Users.cs, etc.) and implemented in matching /// IdentityClient.<Domain>.cs partial classes. /// public partial interface IIdentityClient { // Methods will be added by partial interfaces in W1-5..W1-7. } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Account.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Account.cs ---- using System.Text.Json; using redb.Identity.Contracts.Consents; using redb.Identity.Contracts.Users; namespace redb.Identity.Client; public partial interface IIdentityClient { // ── /me — profile ── /// Get the caller's own profile. Task GetMyProfileAsync(CancellationToken ct = default); /// Update the caller's own profile (PUT). Task UpdateMyProfileAsync(MeUpdateProfileRequest request, CancellationToken ct = default); // ── /me/password ── /// Change the caller's password. All sessions are revoked on success. Task ChangeMyPasswordAsync(MeChangePasswordRequest request, CancellationToken ct = default); // ── /me/sessions ── /// List the caller's own active sessions. Task ListMySessionsAsync(CancellationToken ct = default); /// Revoke the session bound to the caller's current access token. Task RevokeMyCurrentSessionAsync(CancellationToken ct = default); /// Revoke one of the caller's own sessions by id. Task RevokeMySessionAsync(long sessionId, CancellationToken ct = default); /// Revoke all of the caller's sessions except the current one (identified by the sid claim). Task RevokeMyOtherSessionsAsync(CancellationToken ct = default); // ── /me/mfa ── /// Get caller's MFA enrolment status. Task GetMyMfaStatusAsync(CancellationToken ct = default); /// Begin enrolment of an MFA method for the caller. Task SetupMyMfaAsync(IDictionary body, CancellationToken ct = default); /// Confirm a pending MFA enrolment with the OTP code. Task ConfirmMyMfaAsync(IDictionary body, CancellationToken ct = default); /// Disable a single MFA method registered to the caller. Task DisableMyMfaMethodAsync(string method, CancellationToken ct = default); /// Regenerate the caller's recovery codes (invalidates previous codes). Task RegenerateMyRecoveryCodesAsync(CancellationToken ct = default); /// Download the caller's recovery codes as text/plain (also regenerates). Task DownloadMyRecoveryCodesAsync(CancellationToken ct = default); // ── /me/webauthn ── /// Get caller's WebAuthn enrolment status. Task GetMyWebAuthnStatusAsync(CancellationToken ct = default); /// Begin a WebAuthn registration ceremony. Task BeginMyWebAuthnRegistrationAsync(IDictionary body, CancellationToken ct = default); /// Complete WebAuthn registration with browser attestation. Task CompleteMyWebAuthnRegistrationAsync(IDictionary body, CancellationToken ct = default); /// List the caller's registered WebAuthn credentials. Task ListMyWebAuthnCredentialsAsync(CancellationToken ct = default); /// Rename a single WebAuthn credential. Task RenameMyWebAuthnCredentialAsync(string key, IDictionary body, CancellationToken ct = default); /// Delete a single WebAuthn credential. Task DeleteMyWebAuthnCredentialAsync(string key, CancellationToken ct = default); // ── /me/consents ── /// List the caller's valid permanent consent grants. Task ListMyConsentsAsync(CancellationToken ct = default); /// Revoke the caller's permanent consent grant for a single client. Task RevokeMyConsentAsync(string clientId, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string MeBase = "/api/v1/identity/me"; // ── Profile ── public async Task GetMyProfileAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync(MeBase, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateMyProfileAsync(MeUpdateProfileRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync(MeBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // ── Password ── public async Task ChangeMyPasswordAsync(MeChangePasswordRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{MeBase}/password", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // ── Sessions ── public async Task ListMySessionsAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync($"{MeBase}/sessions", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeMyCurrentSessionAsync(CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MeBase}/sessions/current", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeMySessionAsync(long sessionId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MeBase}/sessions/{sessionId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeMyOtherSessionsAsync(CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MeBase}/sessions/others", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // ── MFA (self) ── public async Task GetMyMfaStatusAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync($"{MeBase}/mfa", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task SetupMyMfaAsync(IDictionary body, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{MeBase}/mfa/setup", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task ConfirmMyMfaAsync(IDictionary body, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{MeBase}/mfa/confirm", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DisableMyMfaMethodAsync(string method, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MeBase}/mfa/{Uri.EscapeDataString(method)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RegenerateMyRecoveryCodesAsync(CancellationToken ct = default) { using var resp = await _http.PostAsync($"{MeBase}/mfa/recovery-codes", content: null, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } /// /// Returns the raw so the caller can stream the /// text/plain attachment to disk. Caller is responsible for disposal. /// public async Task DownloadMyRecoveryCodesAsync(CancellationToken ct = default) { var resp = await _http.GetAsync($"{MeBase}/mfa/recovery-codes/download", HttpCompletionOption.ResponseHeadersRead, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); return resp; } // ── WebAuthn (self) ── public async Task GetMyWebAuthnStatusAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync($"{MeBase}/webauthn", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task BeginMyWebAuthnRegistrationAsync(IDictionary body, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{MeBase}/webauthn/register/begin", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CompleteMyWebAuthnRegistrationAsync(IDictionary body, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{MeBase}/webauthn/register/complete", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task ListMyWebAuthnCredentialsAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync($"{MeBase}/webauthn/credentials", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RenameMyWebAuthnCredentialAsync(string key, IDictionary body, CancellationToken ct = default) { var url = $"{MeBase}/webauthn/credentials/{Uri.EscapeDataString(key)}"; using var req = new HttpRequestMessage(HttpMethod.Patch, url) { Content = JsonContent.Create(body, options: _json) }; using var resp = await _http.SendAsync(req, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteMyWebAuthnCredentialAsync(string key, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MeBase}/webauthn/credentials/{Uri.EscapeDataString(key)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // ── Consents (self) ── public async Task ListMyConsentsAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync($"{MeBase}/consents", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeMyConsentAsync(string clientId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MeBase}/consents/{Uri.EscapeDataString(clientId)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } /// /// Grant the caller's permanent consent for an application. Used by native consent UIs /// (e.g. the BFF Razor page) after the user approves a consent_required dialog. /// The user id is taken from the access-token subject; the request body must not include one. /// public async Task GrantMyConsentAsync(string clientId, IEnumerable scopes, CancellationToken ct = default) { var body = new GrantMyConsentRequest { ClientId = clientId, Scopes = scopes.ToArray() }; using var req = new HttpRequestMessage(HttpMethod.Post, $"{MeBase}/consents") { Content = JsonContent.Create(body, options: _json) }; using var resp = await _http.SendAsync(req, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.AccountRegistration.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.AccountRegistration.cs ---- using System.Net; using redb.Identity.Contracts.Users; namespace redb.Identity.Client; public partial interface IIdentityClient { // \u2500\u2500 /account \u2014 N-3 self-service registration (anonymous) \u2500\u2500 /// /// Creates a new user account through the anonymous self-service registration /// endpoint POST /api/v1/identity/account/register. Returns /// { success = true, userId, login } on success. Distinct from the password- /// recovery endpoints, this surface is NOT anti-enumeration: duplicate-login / /// duplicate-email collisions and weak-password violations are returned as /// structured error codes so the calling UI can render an actionable message. /// Requires NO prior authentication. /// Task RegisterAccountAsync( RegisterAccountRequest request, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string AccountBase = "/api/v1/identity/account"; public async Task RegisterAccountAsync( RegisterAccountRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{AccountBase}/register", request, _json, ct).ConfigureAwait(false); // Success path \u2014 the server always returns a structured RegisterAccountResponse // on 2xx, so deserialize directly. if (resp.IsSuccessStatusCode) { return await resp.ReadJsonAsync(ct).ConfigureAwait(false) ?? new RegisterAccountResponse { Success = false, Error = "invalid_response" }; } // Structured failure: the processor wraps every reject path in // RegisterAccountResponse with a stable error code, so we forward it verbatim. // If body deserialization fails (e.g. 404 because the route is gated off and no // body is returned) fall back to a canonical "registration_disabled" envelope. try { var body = await resp.ReadJsonAsync(ct).ConfigureAwait(false); if (body is not null && !string.IsNullOrEmpty(body.Error)) return body; } catch { // Fall through to the canonical fallback below. } var fallbackError = resp.StatusCode switch { HttpStatusCode.NotFound or HttpStatusCode.Forbidden => "registration_disabled", HttpStatusCode.Conflict => "duplicate", HttpStatusCode.BadRequest => "validation_error", _ => "registration_failed", }; return new RegisterAccountResponse { Success = false, Error = fallbackError, ErrorDescription = $"Account registration failed with HTTP status {(int)resp.StatusCode}.", }; } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Applications.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Applications.cs ---- using redb.Identity.Contracts.Applications; using redb.Identity.Contracts.Common; namespace redb.Identity.Client; public partial interface IIdentityClient { Task> ListApplicationsAsync(int offset = 0, int count = 25, CancellationToken ct = default); Task GetApplicationAsync(string id, CancellationToken ct = default); Task CreateApplicationAsync(CreateApplicationRequest request, CancellationToken ct = default); Task UpdateApplicationAsync(string id, UpdateApplicationRequest request, CancellationToken ct = default); Task DeleteApplicationAsync(string id, CancellationToken ct = default); /// /// Rotates the client_secret of a confidential application. The returned /// field carries the freshly generated /// plaintext secret — copy it immediately, subsequent calls will not expose it again /// (server stores only the BCrypt hash). The previous secret stops working at the /// token endpoint as soon as this call succeeds. /// Task RotateApplicationSecretAsync(string id, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string ApplicationsBase = "/api/v1/identity/applications"; public async Task> ListApplicationsAsync(int offset = 0, int count = 25, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ApplicationsBase}?offset={offset}&count={count}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetApplicationAsync(string id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ApplicationsBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateApplicationAsync(CreateApplicationRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(ApplicationsBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateApplicationAsync(string id, UpdateApplicationRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{ApplicationsBase}/{Uri.EscapeDataString(id)}", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteApplicationAsync(string id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ApplicationsBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task RotateApplicationSecretAsync(string id, CancellationToken ct = default) { // Empty content body — server identifies the target purely from the route id. using var resp = await _http.PostAsync( $"{ApplicationsBase}/{Uri.EscapeDataString(id)}/rotate-secret", content: null, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Audit.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Audit.cs ---- using System.Globalization; using redb.Identity.Contracts.Audit; namespace redb.Identity.Client; public partial interface IIdentityClient { /// Query the audit log with the given filters. Task QueryAuditAsync(AuditQueryRequest filter, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string AuditBase = "/api/v1/identity/audit"; public async Task QueryAuditAsync(AuditQueryRequest filter, CancellationToken ct = default) { var qs = BuildAuditQuery(filter); using var resp = await _http.GetAsync($"{AuditBase}{qs}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } private static string BuildAuditQuery(AuditQueryRequest f) { var parts = new List { $"offset={f.Offset}", $"count={f.Count}" }; if (!string.IsNullOrEmpty(f.EventType)) parts.Add($"eventType={Uri.EscapeDataString(f.EventType)}"); if (!string.IsNullOrEmpty(f.Category)) parts.Add($"category={Uri.EscapeDataString(f.Category)}"); if (!string.IsNullOrEmpty(f.UserId)) parts.Add($"userId={Uri.EscapeDataString(f.UserId)}"); if (!string.IsNullOrEmpty(f.Login)) parts.Add($"login={Uri.EscapeDataString(f.Login)}"); if (!string.IsNullOrEmpty(f.ClientId)) parts.Add($"clientId={Uri.EscapeDataString(f.ClientId)}"); if (f.From is { } from) parts.Add($"from={Uri.EscapeDataString(from.ToString("O", CultureInfo.InvariantCulture))}"); if (f.To is { } to) parts.Add($"to={Uri.EscapeDataString(to.ToString("O", CultureInfo.InvariantCulture))}"); return "?" + string.Join("&", parts); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.ChangeEmail.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.ChangeEmail.cs ---- using redb.Identity.Contracts.Users; namespace redb.Identity.Client; public partial interface IIdentityClient { // \u2500\u2500 /me/change-email & /account/change-email \u2014 N4-7 strict change-of-e-mail \u2500\u2500 /// /// Initiates the verify-then-commit change-of-e-mail flow for the authenticated /// caller. Issues a single-use confirmation token bound to the user's current /// address AND the requested new address, and delivers the confirmation link via /// the server's configured e-mail channel \u2014 to the NEW address. The current /// address remains the canonical login until the link is clicked. Requires Bearer /// auth (identity:manage or identity:account) and that the supplied /// is whitelisted on the /// client's ChangeEmailUris. /// Task ChangeEmailRequestAsync(ChangeEmailRequestRequest request, CancellationToken ct = default); /// /// Completes the change-of-e-mail flow by verifying + atomically consuming the /// confirmation token issued earlier (via e-mail to the new address) and atomically /// swapping the user's e-mail to the new value while flipping /// UserProps.EmailVerified=true. The swap is only applied when the user's /// current address still matches the snapshot captured at issue time. All failure /// modes return a generic invalid_token response; granular reason is recorded /// only in audit logs. This call does NOT require any prior authentication. /// Task ChangeEmailConfirmAsync(ChangeEmailConfirmRequest request, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string MeChangeEmailBase = "/api/v1/identity/me/change-email"; private const string AccountChangeEmailBase = "/api/v1/identity/account/change-email"; public async Task ChangeEmailRequestAsync(ChangeEmailRequestRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{MeChangeEmailBase}/request", request, _json, ct).ConfigureAwait(false); resp.EnsureSuccessStatusCode(); return await resp.ReadJsonAsync(ct).ConfigureAwait(false) ?? new ChangeEmailRequestResponse { Success = false }; } public async Task ChangeEmailConfirmAsync(ChangeEmailConfirmRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{AccountChangeEmailBase}/confirm", request, _json, ct).ConfigureAwait(false); if (!resp.IsSuccessStatusCode) { return new ChangeEmailConfirmResponse { Success = false, Error = "invalid_token", ErrorDescription = "The confirmation token is invalid or has expired.", }; } return await resp.ReadJsonAsync(ct).ConfigureAwait(false) ?? new ChangeEmailConfirmResponse { Success = false, Error = "invalid_response" }; } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.ClaimDefinitions.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.ClaimDefinitions.cs ---- using redb.Identity.Client.Internal; using redb.Identity.Contracts.ClaimDefinitions; using redb.Identity.Contracts.Common; namespace redb.Identity.Client; public partial interface IIdentityClient { Task> ListClaimDefinitionsAsync(int offset = 0, int count = 50, string? scope = null, long? applicationId = null, CancellationToken ct = default); Task GetClaimDefinitionAsync(long id, CancellationToken ct = default); Task CreateClaimDefinitionAsync(CreateClaimDefinitionRequest request, CancellationToken ct = default); Task UpdateClaimDefinitionAsync(long id, UpdateClaimDefinitionRequest request, CancellationToken ct = default); Task DeleteClaimDefinitionAsync(long id, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string ClaimDefinitionsBase = "/api/v1/identity/claim-definitions"; public async Task> ListClaimDefinitionsAsync( int offset = 0, int count = 50, string? scope = null, long? applicationId = null, CancellationToken ct = default) { var url = $"{ClaimDefinitionsBase}?offset={offset}&count={count}"; if (!string.IsNullOrEmpty(scope)) url += $"&scope={Uri.EscapeDataString(scope)}"; if (applicationId.HasValue) url += $"&applicationId={applicationId.Value}"; using var resp = await _http.GetAsync(url, ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetClaimDefinitionAsync(long id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ClaimDefinitionsBase}/{id}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateClaimDefinitionAsync(CreateClaimDefinitionRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(ClaimDefinitionsBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateClaimDefinitionAsync(long id, UpdateClaimDefinitionRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{ClaimDefinitionsBase}/{id}", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteClaimDefinitionAsync(long id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ClaimDefinitionsBase}/{id}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.ClaimMappers.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.ClaimMappers.cs ---- using redb.Identity.Contracts.ClaimMappers; using redb.Identity.Contracts.Common; namespace redb.Identity.Client; public partial interface IIdentityClient { // ── Claim mappers ── Task> ListClaimMappersAsync(string? owner = null, int offset = 0, int count = 25, CancellationToken ct = default); Task GetClaimMapperAsync(string id, CancellationToken ct = default); Task CreateClaimMapperAsync(CreateClaimMapperRequest request, CancellationToken ct = default); Task UpdateClaimMapperAsync(string id, UpdateClaimMapperRequest request, CancellationToken ct = default); Task DeleteClaimMapperAsync(string id, CancellationToken ct = default); // ── Claim scopes (mapper bundles) ── Task> ListClaimScopesAsync(int offset = 0, int count = 25, CancellationToken ct = default); Task GetClaimScopeAsync(string id, CancellationToken ct = default); Task CreateClaimScopeAsync(CreateClaimScopeRequest request, CancellationToken ct = default); Task UpdateClaimScopeAsync(string id, UpdateClaimScopeRequest request, CancellationToken ct = default); Task DeleteClaimScopeAsync(string id, CancellationToken ct = default); // ── Application ↔ Scope assignments ── Task ListClaimScopeAssignmentsAsync(string applicationId, CancellationToken ct = default); Task AssignClaimScopeAsync(AssignClaimScopeRequest request, CancellationToken ct = default); Task UnassignClaimScopeAsync(string applicationId, string scopeId, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string ClaimMappersBase = "/api/v1/identity/claim-mappers"; private const string ClaimScopesBase = "/api/v1/identity/claim-scopes"; public async Task> ListClaimMappersAsync(string? owner = null, int offset = 0, int count = 25, CancellationToken ct = default) { var url = $"{ClaimMappersBase}?offset={offset}&count={count}" + (owner is null ? "" : $"&owner={Uri.EscapeDataString(owner)}"); using var resp = await _http.GetAsync(url, ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetClaimMapperAsync(string id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ClaimMappersBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateClaimMapperAsync(CreateClaimMapperRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(ClaimMappersBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateClaimMapperAsync(string id, UpdateClaimMapperRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{ClaimMappersBase}/{Uri.EscapeDataString(id)}", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteClaimMapperAsync(string id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ClaimMappersBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } // ── Claim scopes ── public async Task> ListClaimScopesAsync(int offset = 0, int count = 25, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ClaimScopesBase}?offset={offset}&count={count}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetClaimScopeAsync(string id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ClaimScopesBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateClaimScopeAsync(CreateClaimScopeRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(ClaimScopesBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateClaimScopeAsync(string id, UpdateClaimScopeRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{ClaimScopesBase}/{Uri.EscapeDataString(id)}", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteClaimScopeAsync(string id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ClaimScopesBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } // ── Application ↔ Scope assignments ── public async Task ListClaimScopeAssignmentsAsync(string applicationId, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ClaimScopesBase}/assignments?applicationId={Uri.EscapeDataString(applicationId)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task AssignClaimScopeAsync(AssignClaimScopeRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{ClaimScopesBase}/assignments", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UnassignClaimScopeAsync(string applicationId, string scopeId, CancellationToken ct = default) { var url = $"{ClaimScopesBase}/assignments?applicationId={Uri.EscapeDataString(applicationId)}&scopeId={Uri.EscapeDataString(scopeId)}"; using var resp = await _http.DeleteAsync(url, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Consents.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Consents.cs ---- using System.Text.Json; namespace redb.Identity.Client; public partial interface IIdentityClient { /// List consent grants for a user (admin). Task ListUserConsentsAsync(long userId, CancellationToken ct = default); /// Revoke a single consent grant (admin). Task RevokeUserConsentAsync(long userId, long applicationId, CancellationToken ct = default); /// Revoke all consent grants of a user (admin). Task RevokeAllUserConsentsAsync(long userId, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string ConsentsAdminBase = "/api/v1/identity/consents"; public async Task ListUserConsentsAsync(long userId, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ConsentsAdminBase}?userId={userId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeUserConsentAsync(long userId, long applicationId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ConsentsAdminBase}?userId={userId}&applicationId={applicationId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeAllUserConsentsAsync(long userId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ConsentsAdminBase}/all?userId={userId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.EmailVerification.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.EmailVerification.cs ---- using System.Text.Json; using redb.Identity.Contracts.Users; namespace redb.Identity.Client; public partial interface IIdentityClient { // ── /me/verify-email & /account/verify-email \u2014 N4-6 e-mail verification ── /// /// Initiates the e-mail-verification flow for the authenticated caller. Issues a /// single-use verification token bound to the caller's current e-mail address and /// delivers it via the server's configured e-mail channel. Requires Bearer auth /// (identity:manage or identity:account) and that the supplied /// is whitelisted on the /// client's EmailVerifyUris. /// Task VerifyEmailSendAsync(EmailVerifySendRequest request, CancellationToken ct = default); /// /// Completes the e-mail-verification flow by verifying + atomically consuming the /// verification token issued earlier (via e-mail) and flipping /// UserProps.EmailVerified to true when the bound e-mail still /// matches the user's current address (double-change race protection). All failure /// modes return a generic invalid_token response; granular reason is recorded /// only in audit logs. This call does NOT require any prior authentication. /// Task VerifyEmailConfirmAsync(EmailVerifyConfirmRequest request, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string MeVerifyEmailBase = "/api/v1/identity/me/verify-email"; private const string AccountVerifyEmailBase = "/api/v1/identity/account/verify-email"; public async Task VerifyEmailSendAsync(EmailVerifySendRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{MeVerifyEmailBase}/send", request, _json, ct).ConfigureAwait(false); resp.EnsureSuccessStatusCode(); return await resp.ReadJsonAsync(ct).ConfigureAwait(false) ?? new EmailVerifySendResponse { Success = false }; } public async Task VerifyEmailConfirmAsync(EmailVerifyConfirmRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{AccountVerifyEmailBase}/confirm", request, _json, ct).ConfigureAwait(false); // Mirror ResetPasswordAsync: any non-2xx is collapsed into a generic invalid_token // envelope so callers cannot distinguish "wrong jti" from "expired" from "consumed". if (!resp.IsSuccessStatusCode) { return new EmailVerifyConfirmResponse { Success = false, Error = "invalid_token", ErrorDescription = "The verification token is invalid or has expired.", }; } return await resp.ReadJsonAsync(ct).ConfigureAwait(false) ?? new EmailVerifyConfirmResponse { Success = false, Error = "invalid_response" }; } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Federation.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Federation.cs ---- using redb.Identity.Contracts.Common; using redb.Identity.Contracts.Federation; namespace redb.Identity.Client; public partial interface IIdentityClient { Task> ListFederationProvidersAsync(int offset = 0, int count = 25, CancellationToken ct = default); Task GetFederationProviderAsync(string id, CancellationToken ct = default); Task CreateFederationProviderAsync(CreateFederationProviderRequest request, CancellationToken ct = default); Task UpdateFederationProviderAsync(string id, UpdateFederationProviderRequest request, CancellationToken ct = default); Task DeleteFederationProviderAsync(string id, CancellationToken ct = default); /// /// Returns the public projection of configured federation providers (anonymous — /// safe for unauthenticated login pages). Strips ClientSecret, Authority, /// scope list and other secret/configuration fields. Carries only ProviderId, /// DisplayName, Kind and Priority — enough to render a sign-in button. /// Task> ListPublicFederationProvidersAsync(CancellationToken ct = default); } public sealed partial class IdentityClient { private const string FederationBase = "/api/v1/identity/federation-providers"; public async Task> ListFederationProvidersAsync(int offset = 0, int count = 25, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{FederationBase}?offset={offset}&count={count}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetFederationProviderAsync(string id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{FederationBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateFederationProviderAsync(CreateFederationProviderRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(FederationBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateFederationProviderAsync(string id, UpdateFederationProviderRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{FederationBase}/{Uri.EscapeDataString(id)}", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteFederationProviderAsync(string id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{FederationBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } /// public async Task> ListPublicFederationProvidersAsync(CancellationToken ct = default) { // No Authorization header is sent for this call (uses _http baseline; the public // endpoint is allow-anonymous). Callers that have a bearer token attached at the // HttpClient level will still succeed — the endpoint simply ignores it. using var resp = await _http.GetAsync($"{FederationBase}/public", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); var list = await resp.Content .ReadFromJsonAsync>(_json, ct) .ConfigureAwait(false); return (IReadOnlyList?)list ?? Array.Empty(); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Groups.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Groups.cs ---- using System.Text.Json; using redb.Identity.Client.Internal; using redb.Identity.Contracts.Common; using redb.Identity.Contracts.Groups; namespace redb.Identity.Client; public partial interface IIdentityClient { // ── Group CRUD ── Task> ListRootGroupsAsync(int offset = 0, int count = 25, CancellationToken ct = default); Task> SearchGroupsAsync( string? query = null, string? groupType = null, int offset = 0, int count = 25, CancellationToken ct = default); Task GetGroupAsync(long id, CancellationToken ct = default); Task CreateGroupAsync(CreateGroupRequest request, CancellationToken ct = default); Task CreateChildGroupAsync(long parentId, CreateGroupRequest request, CancellationToken ct = default); Task UpdateGroupAsync(long id, UpdateGroupRequest request, CancellationToken ct = default); Task DeleteGroupAsync(long id, CancellationToken ct = default); Task MoveGroupAsync(long id, MoveGroupRequest request, CancellationToken ct = default); // ── Tree operations ── Task GetGroupTreeAsync(long id, CancellationToken ct = default); Task> GetGroupPathAsync(long id, CancellationToken ct = default); Task> GetGroupChildrenAsync(long id, CancellationToken ct = default); // ── Membership ── Task> ListGroupMembersAsync(long id, CancellationToken ct = default); Task AddGroupMemberAsync(long id, AddMemberRequest request, CancellationToken ct = default); Task UpdateGroupMemberAsync(long id, long userId, UpdateMemberRequest request, CancellationToken ct = default); Task RemoveGroupMemberAsync(long id, long userId, CancellationToken ct = default); Task GetUserGroupsAsync(long userId, CancellationToken ct = default); Task IsGroupMemberAsync(long id, long userId, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string GroupsBase = "/api/v1/identity/groups"; public async Task> ListRootGroupsAsync(int offset = 0, int count = 25, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{GroupsBase}?offset={offset}&count={count}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task> SearchGroupsAsync( string? query = null, string? groupType = null, int offset = 0, int count = 25, CancellationToken ct = default) { var url = $"{GroupsBase}/search?offset={offset}&count={count}"; if (!string.IsNullOrEmpty(query)) url += $"&query={Uri.EscapeDataString(query)}"; if (!string.IsNullOrEmpty(groupType)) url += $"&groupType={Uri.EscapeDataString(groupType)}"; using var resp = await _http.GetAsync(url, ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetGroupAsync(long id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{GroupsBase}/{id}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateGroupAsync(CreateGroupRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(GroupsBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateChildGroupAsync(long parentId, CreateGroupRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{GroupsBase}/{parentId}/children", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateGroupAsync(long id, UpdateGroupRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{GroupsBase}/{id}", request, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task DeleteGroupAsync(long id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{GroupsBase}/{id}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task MoveGroupAsync(long id, MoveGroupRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{GroupsBase}/{id}/move", request, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } // ── Tree operations ── public async Task GetGroupTreeAsync(long id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{GroupsBase}/{id}/tree", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task> GetGroupPathAsync(long id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{GroupsBase}/{id}/path", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task> GetGroupChildrenAsync(long id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{GroupsBase}/{id}/children", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } // ── Membership ── public async Task> ListGroupMembersAsync(long id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{GroupsBase}/{id}/members", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task AddGroupMemberAsync(long id, AddMemberRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{GroupsBase}/{id}/members", request, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task UpdateGroupMemberAsync(long id, long userId, UpdateMemberRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{GroupsBase}/{id}/members/{userId}", request, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task RemoveGroupMemberAsync(long id, long userId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{GroupsBase}/{id}/members/{userId}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task GetUserGroupsAsync(long userId, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{GroupsBase}/users/{userId}/groups", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task IsGroupMemberAsync(long id, long userId, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{GroupsBase}/{id}/members/{userId}/check", ct).ConfigureAwait(false); var doc = await resp.ReadJsonAsync(ct).ConfigureAwait(false); return doc.TryGetProperty("isMember", out var prop) && prop.ValueKind == JsonValueKind.True; } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Impersonation.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Impersonation.cs ---- using System.Text.Json; namespace redb.Identity.Client; public partial interface IIdentityClient { /// /// N7-3 — start an admin impersonation overlay (audit beacon). /// Returns the resolved target user info. Requires identity:impersonate /// or master identity:manage scope on the caller's bearer token. /// Task StartImpersonationAsync(long targetUserId, string? reason = null, CancellationToken ct = default); /// /// N7-3 — stop an admin impersonation overlay (audit beacon). Same scope requirement. /// Task StopImpersonationAsync(long targetUserId, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string ImpersonationBase = "/api/v1/identity/admin/impersonate"; /// public async Task StartImpersonationAsync(long targetUserId, string? reason = null, CancellationToken ct = default) { var body = new { reason }; using var resp = await _http.PostAsJsonAsync($"{ImpersonationBase}/start/{targetUserId}", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } /// public async Task StopImpersonationAsync(long targetUserId, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{ImpersonationBase}/stop/{targetUserId}", new { }, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Info.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Info.cs ---- using System.Text.Json; namespace redb.Identity.Client; public partial interface IIdentityClient { /// OIDC discovery document, read at {Authority}/.well-known/openid-configuration /// () and kept for the life of the client. Task GetDiscoveryDocumentAsync(CancellationToken ct = default); /// JWKS, read at the jwks_uri the discovery document names. Task GetJwksAsync(CancellationToken ct = default); } public sealed partial class IdentityClient { public Task GetDiscoveryDocumentAsync(CancellationToken ct = default) => _discovery.GetDocumentAsync(ct); public async Task GetJwksAsync(CancellationToken ct = default) { var jwksUri = await _discovery.GetEndpointAsync("jwks_uri", ct).ConfigureAwait(false); using var resp = await _http.GetAsync(jwksUri, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Mfa.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Mfa.cs ---- using System.Text.Json; namespace redb.Identity.Client; public partial interface IIdentityClient { // ── Status ── /// Get MFA enrolment status for a user (admin). Task GetUserMfaStatusAsync(long userId, CancellationToken ct = default); // ── TOTP ── /// Begin TOTP setup for a user (admin). Returns QR/secret. Task SetupUserTotpAsync(long userId, string username, CancellationToken ct = default); /// Confirm TOTP setup (admin) with the first code and the setup_token of the setup answer. Task ConfirmUserTotpAsync(long userId, string code, string setupToken, CancellationToken ct = default); /// Disable TOTP for a user (admin). Task DisableUserTotpAsync(long userId, CancellationToken ct = default); // ── Recovery codes ── /// Regenerate recovery codes for a user (admin). Returns plain codes ONCE. Task RegenerateUserRecoveryCodesAsync(long userId, CancellationToken ct = default); // ── SMS ── /// Begin SMS OTP setup for a user (admin). Task SetupUserSmsAsync(long userId, string username, string destination, CancellationToken ct = default); /// Confirm SMS OTP setup (admin). Task ConfirmUserSmsAsync(long userId, string code, string? mfaState = null, CancellationToken ct = default); /// Disable SMS OTP for a user (admin). Task DisableUserSmsAsync(long userId, CancellationToken ct = default); // ── Email ── /// Begin Email OTP setup for a user (admin). Task SetupUserEmailAsync(long userId, string username, string destination, CancellationToken ct = default); /// Confirm Email OTP setup (admin) with the code from the e-mail and the mfa_state and setup_token the setup call returned. Task ConfirmUserEmailAsync(long userId, string code, string mfaState, string setupToken, CancellationToken ct = default); /// Disable Email OTP for a user (admin). Task DisableUserEmailAsync(long userId, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string MfaAdminBase = "/api/v1/identity/mfa"; public async Task GetUserMfaStatusAsync(long userId, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{MfaAdminBase}/status/{userId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // TOTP public async Task SetupUserTotpAsync(long userId, string username, CancellationToken ct = default) { var body = new { userId, username }; using var resp = await _http.PostAsJsonAsync($"{MfaAdminBase}/totp/setup", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task ConfirmUserTotpAsync(long userId, string code, string setupToken, CancellationToken ct = default) { var body = new { userId, code, setupToken }; using var resp = await _http.PostAsJsonAsync($"{MfaAdminBase}/totp/confirm", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DisableUserTotpAsync(long userId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MfaAdminBase}/totp/{userId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // Recovery codes public async Task RegenerateUserRecoveryCodesAsync(long userId, CancellationToken ct = default) { var body = new { userId }; using var resp = await _http.PostAsJsonAsync($"{MfaAdminBase}/recovery-codes/regenerate", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // SMS public async Task SetupUserSmsAsync(long userId, string username, string destination, CancellationToken ct = default) { var body = new { userId, username, destination }; using var resp = await _http.PostAsJsonAsync($"{MfaAdminBase}/sms/setup", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task ConfirmUserSmsAsync(long userId, string code, string? mfaState = null, CancellationToken ct = default) { var body = new { userId, code, mfaState }; using var resp = await _http.PostAsJsonAsync($"{MfaAdminBase}/sms/confirm", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DisableUserSmsAsync(long userId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MfaAdminBase}/sms/{userId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // Email public async Task SetupUserEmailAsync(long userId, string username, string destination, CancellationToken ct = default) { var body = new { userId, username, destination }; using var resp = await _http.PostAsJsonAsync($"{MfaAdminBase}/email/setup", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task ConfirmUserEmailAsync(long userId, string code, string mfaState, string setupToken, CancellationToken ct = default) { var body = new { userId, code, mfaState, setupToken }; using var resp = await _http.PostAsJsonAsync($"{MfaAdminBase}/email/confirm", body, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DisableUserEmailAsync(long userId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{MfaAdminBase}/email/{userId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.PasswordRecovery.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.PasswordRecovery.cs ---- using System.Text.Json; using redb.Identity.Contracts.Users; namespace redb.Identity.Client; public partial interface IIdentityClient { // ── /password — N-4 password recovery (anonymous) ── /// /// Initiates the password-recovery flow for the supplied e-mail. Anti-enumeration: /// always returns { success = true }, even when the e-mail does not match a /// known user, the client is unknown, or the supplied callerResetUrl is not /// whitelisted on the client. This call does NOT require any prior authentication. /// Task ForgotPasswordAsync(PasswordForgotRequest request, CancellationToken ct = default); /// /// Completes the password-recovery flow by verifying + atomically consuming the /// reset token issued earlier (via e-mail) and setting the new password. Revokes /// every active session on success. All failure modes return a generic /// invalid_token response with no granular reason \u2014 the actual cause is /// recorded only in audit logs. This call does NOT require any prior authentication. /// Task ResetPasswordAsync(PasswordResetRequest request, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string PasswordBase = "/api/v1/identity/password"; public async Task ForgotPasswordAsync(PasswordForgotRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{PasswordBase}/forgot", request, _json, ct).ConfigureAwait(false); // Anti-enumeration: facade always returns 200 success regardless of outcome, // so we do not interpret the status as a signal here. return await resp.ReadJsonAsync(ct).ConfigureAwait(false) ?? new PasswordForgotResponse(); } public async Task ResetPasswordAsync(PasswordResetRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{PasswordBase}/reset", request, _json, ct).ConfigureAwait(false); // Treat any non-2xx as a generic failure; the server already deliberately collapses // every reset-failure cause into "invalid_token" to deny attackers useful signal. if (!resp.IsSuccessStatusCode) { return new PasswordResetResponse { Success = false, Error = "invalid_token", ErrorDescription = "The reset token is invalid or has expired.", }; } return await resp.ReadJsonAsync(ct).ConfigureAwait(false) ?? new PasswordResetResponse { Success = false, Error = "invalid_response" }; } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.RevokedSids.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.RevokedSids.cs ---- using System.Text.Json; using redb.Identity.Contracts.Sessions; namespace redb.Identity.Client; public partial interface IIdentityClient { /// /// W6-0: Publish a backchannel revocation entry. At least one of /// / MUST be supplied. /// /// OIDC sid claim of the revoked session, or null. /// OIDC sub claim. Set without for a /// "revoke all sessions of subject" entry. /// Optional client_id scope. Null = applies to all clients. /// When the entry expires. Server clamps to the configured /// RevokedSidsMaxRetention upper bound. Task AddRevokedSidAsync( string? sid, string? sub, string? clientId, DateTimeOffset? expiresAt = null, CancellationToken ct = default); /// /// W6-0: Incremental poll of the backchannel revoked-sids list. Pass /// from the previous response on /// subsequent calls; omit on the first call to receive a baseline window. /// Task GetRevokedSidsSinceAsync( DateTimeOffset? cursor = null, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string RevokedSidsBase = "/api/v1/identity/revoked-sids"; public async Task AddRevokedSidAsync( string? sid, string? sub, string? clientId, DateTimeOffset? expiresAt = null, CancellationToken ct = default) { var request = new RevokedSidsAddRequest { Sid = sid, Sub = sub, ClientId = clientId, ExpiresAt = expiresAt }; using var resp = await _http.PostAsJsonAsync(RevokedSidsBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task GetRevokedSidsSinceAsync( DateTimeOffset? cursor = null, CancellationToken ct = default) { var url = cursor.HasValue ? $"{RevokedSidsBase}/since?cursor={Uri.EscapeDataString(cursor.Value.ToString("O"))}" : $"{RevokedSidsBase}/since"; using var resp = await _http.GetAsync(url, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Roles.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Roles.cs ---- using redb.Identity.Client.Internal; using redb.Identity.Contracts.Common; using redb.Identity.Contracts.Roles; namespace redb.Identity.Client; public partial interface IIdentityClient { Task> SearchRolesAsync( string? query = null, string? audience = null, long? applicationId = null, int offset = 0, int count = 25, CancellationToken ct = default); Task GetRoleAsync(long id, CancellationToken ct = default); Task CreateRoleAsync(CreateRoleRequest request, CancellationToken ct = default); Task UpdateRoleAsync(long id, UpdateRoleRequest request, CancellationToken ct = default); Task DeleteRoleAsync(long id, CancellationToken ct = default); Task> ListRoleAssigneesAsync(long roleId, CancellationToken ct = default); Task AssignUserToRoleAsync(long roleId, long userId, CancellationToken ct = default); Task UnassignUserFromRoleAsync(long roleId, long userId, CancellationToken ct = default); Task AssignGroupToRoleAsync(long roleId, long groupId, CancellationToken ct = default); Task UnassignGroupFromRoleAsync(long roleId, long groupId, CancellationToken ct = default); Task> ListRoleScopesAsync(long roleId, CancellationToken ct = default); Task AttachScopeToRoleAsync(long roleId, long scopeId, CancellationToken ct = default); Task DetachScopeFromRoleAsync(long roleId, long scopeId, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string RolesBase = "/api/v1/identity/roles"; public async Task> SearchRolesAsync( string? query = null, string? audience = null, long? applicationId = null, int offset = 0, int count = 25, CancellationToken ct = default) { var url = $"{RolesBase}?offset={offset}&count={count}"; if (!string.IsNullOrEmpty(query)) url += $"&query={Uri.EscapeDataString(query)}"; if (!string.IsNullOrEmpty(audience)) url += $"&audience={Uri.EscapeDataString(audience)}"; if (applicationId.HasValue) url += $"&applicationId={applicationId.Value}"; using var resp = await _http.GetAsync(url, ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetRoleAsync(long id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{RolesBase}/{id}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateRoleAsync(CreateRoleRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(RolesBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateRoleAsync(long id, UpdateRoleRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{RolesBase}/{id}", request, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task DeleteRoleAsync(long id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{RolesBase}/{id}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task> ListRoleAssigneesAsync(long roleId, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{RolesBase}/{roleId}/assignees", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task AssignUserToRoleAsync(long roleId, long userId, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{RolesBase}/{roleId}/users", new Dictionary { ["userId"] = userId }, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task UnassignUserFromRoleAsync(long roleId, long userId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{RolesBase}/{roleId}/users/{userId}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task AssignGroupToRoleAsync(long roleId, long groupId, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{RolesBase}/{roleId}/groups", new Dictionary { ["groupId"] = groupId }, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task UnassignGroupFromRoleAsync(long roleId, long groupId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{RolesBase}/{roleId}/groups/{groupId}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task> ListRoleScopesAsync(long roleId, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{RolesBase}/{roleId}/scopes", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task AttachScopeToRoleAsync(long roleId, long scopeId, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{RolesBase}/{roleId}/scopes", new Dictionary { ["scopeId"] = scopeId }, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task DetachScopeFromRoleAsync(long roleId, long scopeId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{RolesBase}/{roleId}/scopes/{scopeId}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Scim.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Scim.cs ---- using System.Text.Json; using redb.Identity.Contracts.Scim; namespace redb.Identity.Client; public partial interface IIdentityClient { // ── Discovery ── /// SCIM 2.0 ServiceProviderConfig (RFC 7643 §5). Task GetScimServiceProviderConfigAsync(CancellationToken ct = default); /// SCIM 2.0 ResourceTypes list. Task GetScimResourceTypesAsync(CancellationToken ct = default); /// SCIM 2.0 Schemas list. Task GetScimSchemasAsync(CancellationToken ct = default); // ── Users ── /// List SCIM users (startIndex/count + optional filter — SCIM 2.0 spec). Task> ListScimUsersAsync(int startIndex = 1, int count = 25, string? filter = null, string? sortBy = null, string? sortOrder = null, CancellationToken ct = default); Task GetScimUserAsync(string id, CancellationToken ct = default); Task CreateScimUserAsync(ScimUser user, CancellationToken ct = default); Task ReplaceScimUserAsync(string id, ScimUser user, CancellationToken ct = default); Task PatchScimUserAsync(string id, ScimPatchRequest patch, CancellationToken ct = default); Task DeleteScimUserAsync(string id, CancellationToken ct = default); // ── Groups ── Task> ListScimGroupsAsync(int startIndex = 1, int count = 25, string? filter = null, string? sortBy = null, string? sortOrder = null, CancellationToken ct = default); Task GetScimGroupAsync(string id, CancellationToken ct = default); Task CreateScimGroupAsync(ScimGroup group, CancellationToken ct = default); Task ReplaceScimGroupAsync(string id, ScimGroup group, CancellationToken ct = default); Task PatchScimGroupAsync(string id, ScimPatchRequest patch, CancellationToken ct = default); Task DeleteScimGroupAsync(string id, CancellationToken ct = default); // ── Bulk ── /// SCIM 2.0 Bulk operations (RFC 7644 §3.7). Task ExecuteScimBulkAsync(ScimBulkRequest request, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string ScimBase = "/scim/v2"; // ── Discovery ── public async Task GetScimServiceProviderConfigAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ScimBase}/ServiceProviderConfig", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task GetScimResourceTypesAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ScimBase}/ResourceTypes", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task GetScimSchemasAsync(CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ScimBase}/Schemas", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } // ── Users ── public async Task> ListScimUsersAsync(int startIndex = 1, int count = 25, string? filter = null, string? sortBy = null, string? sortOrder = null, CancellationToken ct = default) { using var resp = await _http.GetAsync(BuildScimListUrl($"{ScimBase}/Users", startIndex, count, filter, sortBy, sortOrder), ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetScimUserAsync(string id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ScimBase}/Users/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateScimUserAsync(ScimUser user, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{ScimBase}/Users", user, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task ReplaceScimUserAsync(string id, ScimUser user, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{ScimBase}/Users/{Uri.EscapeDataString(id)}", user, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task PatchScimUserAsync(string id, ScimPatchRequest patch, CancellationToken ct = default) { var url = $"{ScimBase}/Users/{Uri.EscapeDataString(id)}"; using var req = new HttpRequestMessage(HttpMethod.Patch, url) { Content = JsonContent.Create(patch, options: _json) }; using var resp = await _http.SendAsync(req, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteScimUserAsync(string id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ScimBase}/Users/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } // ── Groups ── public async Task> ListScimGroupsAsync(int startIndex = 1, int count = 25, string? filter = null, string? sortBy = null, string? sortOrder = null, CancellationToken ct = default) { using var resp = await _http.GetAsync(BuildScimListUrl($"{ScimBase}/Groups", startIndex, count, filter, sortBy, sortOrder), ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetScimGroupAsync(string id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ScimBase}/Groups/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateScimGroupAsync(ScimGroup group, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{ScimBase}/Groups", group, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task ReplaceScimGroupAsync(string id, ScimGroup group, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{ScimBase}/Groups/{Uri.EscapeDataString(id)}", group, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task PatchScimGroupAsync(string id, ScimPatchRequest patch, CancellationToken ct = default) { var url = $"{ScimBase}/Groups/{Uri.EscapeDataString(id)}"; using var req = new HttpRequestMessage(HttpMethod.Patch, url) { Content = JsonContent.Create(patch, options: _json) }; using var resp = await _http.SendAsync(req, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteScimGroupAsync(string id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ScimBase}/Groups/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } // ── Bulk ── public async Task ExecuteScimBulkAsync(ScimBulkRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{ScimBase}/Bulk", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } private static string BuildScimListUrl(string basePath, int startIndex, int count, string? filter, string? sortBy, string? sortOrder) { var parts = new List { $"startIndex={startIndex}", $"count={count}" }; if (!string.IsNullOrEmpty(filter)) parts.Add($"filter={Uri.EscapeDataString(filter)}"); if (!string.IsNullOrEmpty(sortBy)) parts.Add($"sortBy={Uri.EscapeDataString(sortBy)}"); if (!string.IsNullOrEmpty(sortOrder)) parts.Add($"sortOrder={Uri.EscapeDataString(sortOrder)}"); return $"{basePath}?{string.Join("&", parts)}"; } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Scopes.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Scopes.cs ---- using redb.Identity.Contracts.Common; using redb.Identity.Contracts.Scopes; namespace redb.Identity.Client; public partial interface IIdentityClient { Task> ListScopesAsync(int offset = 0, int count = 25, CancellationToken ct = default); Task GetScopeAsync(string id, CancellationToken ct = default); Task CreateScopeAsync(CreateScopeRequest request, CancellationToken ct = default); Task UpdateScopeAsync(string id, UpdateScopeRequest request, CancellationToken ct = default); Task DeleteScopeAsync(string id, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string ScopesBase = "/api/v1/identity/scopes"; public async Task> ListScopesAsync(int offset = 0, int count = 25, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ScopesBase}?offset={offset}&count={count}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetScopeAsync(string id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{ScopesBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateScopeAsync(CreateScopeRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(ScopesBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateScopeAsync(string id, UpdateScopeRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{ScopesBase}/{Uri.EscapeDataString(id)}", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteScopeAsync(string id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{ScopesBase}/{Uri.EscapeDataString(id)}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Sessions.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Sessions.cs ---- using System.Text.Json; namespace redb.Identity.Client; public partial interface IIdentityClient { /// List active sessions for a user (admin). Task ListSessionsAsync(long userId, CancellationToken ct = default); Task ListAllSessionsAsync(int offset = 0, int count = 25, CancellationToken ct = default); /// Revoke a single session by id (admin). Task RevokeSessionAsync(long sessionId, CancellationToken ct = default); /// Revoke all sessions of a user (admin). Task RevokeAllUserSessionsAsync(long userId, CancellationToken ct = default); /// Force-logout a user (revokes sessions + tokens, admin). Task ForceLogoutUserAsync(long userId, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string SessionsBase = "/api/v1/identity/sessions"; public async Task ListSessionsAsync(long userId, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{SessionsBase}?userId={userId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } /// /// Admin-wide paginated browse of active sessions across all users — /// powers the /admin/sessions default view. /// stays the targeted per-user path. /// public async Task ListAllSessionsAsync(int offset = 0, int count = 25, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{SessionsBase}?offset={offset}&count={count}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeSessionAsync(long sessionId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{SessionsBase}?sessionId={sessionId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeAllUserSessionsAsync(long userId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{SessionsBase}/all?userId={userId}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task ForceLogoutUserAsync(long userId, CancellationToken ct = default) { using var resp = await _http.PostAsync($"{SessionsBase}/logout?userId={userId}", content: null, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Token.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Token.cs ---- using System.Net.Http.Headers; using System.Text.Json; using redb.Identity.Contracts.Tokens; namespace redb.Identity.Client; public partial interface IIdentityClient { /// OAuth/OIDC token endpoint (RFC 6749 §3.2). Sends form-urlencoded body. Task RequestTokenAsync(TokenRequest request, CancellationToken ct = default); /// Token introspection (RFC 7662). Client-authenticated. Task IntrospectTokenAsync(string token, string? tokenTypeHint = null, string? clientId = null, string? clientSecret = null, CancellationToken ct = default); /// Token revocation (RFC 7009). Client-authenticated. Task RevokeOAuthTokenAsync(string token, string? tokenTypeHint = null, string? clientId = null, string? clientSecret = null, CancellationToken ct = default); /// OIDC UserInfo endpoint. Requires Bearer access token with openid scope. Task GetUserInfoAsync(CancellationToken ct = default); } public sealed partial class IdentityClient { // Every endpoint here is the one the discovery document at IdentityClientOptions.Authority names. public async Task RequestTokenAsync(TokenRequest request, CancellationToken ct = default) { var form = ToFormFields(request); var endpoint = await _discovery.GetEndpointAsync("token_endpoint", ct).ConfigureAwait(false); using var resp = await _http.PostAsync(endpoint, new FormUrlEncodedContent(form), ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task IntrospectTokenAsync(string token, string? tokenTypeHint = null, string? clientId = null, string? clientSecret = null, CancellationToken ct = default) { var form = new List> { new("token", token) }; if (tokenTypeHint is not null) form.Add(new("token_type_hint", tokenTypeHint)); if (clientId is not null) form.Add(new("client_id", clientId)); if (clientSecret is not null) form.Add(new("client_secret", clientSecret)); var endpoint = await _discovery.GetEndpointAsync("introspection_endpoint", ct).ConfigureAwait(false); using var resp = await _http.PostAsync(endpoint, new FormUrlEncodedContent(form), ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeOAuthTokenAsync(string token, string? tokenTypeHint = null, string? clientId = null, string? clientSecret = null, CancellationToken ct = default) { var form = new List> { new("token", token) }; if (tokenTypeHint is not null) form.Add(new("token_type_hint", tokenTypeHint)); if (clientId is not null) form.Add(new("client_id", clientId)); if (clientSecret is not null) form.Add(new("client_secret", clientSecret)); var endpoint = await _discovery.GetEndpointAsync("revocation_endpoint", ct).ConfigureAwait(false); using var resp = await _http.PostAsync(endpoint, new FormUrlEncodedContent(form), ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task GetUserInfoAsync(CancellationToken ct = default) { var endpoint = await _discovery.GetEndpointAsync("userinfo_endpoint", ct).ConfigureAwait(false); using var req = new HttpRequestMessage(HttpMethod.Get, endpoint); req.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); using var resp = await _http.SendAsync(req, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } private static List> ToFormFields(TokenRequest req) { var fields = new List> { new("grant_type", req.GrantType), }; if (req.ClientId is not null) fields.Add(new("client_id", req.ClientId)); if (req.ClientSecret is not null) fields.Add(new("client_secret", req.ClientSecret)); if (req.Scope is not null) fields.Add(new("scope", req.Scope)); if (req.Code is not null) fields.Add(new("code", req.Code)); if (req.RedirectUri is not null) fields.Add(new("redirect_uri", req.RedirectUri)); if (req.RefreshToken is not null) fields.Add(new("refresh_token", req.RefreshToken)); if (req.CodeVerifier is not null) fields.Add(new("code_verifier", req.CodeVerifier)); if (req.Username is not null) fields.Add(new("username", req.Username)); if (req.Password is not null) fields.Add(new("password", req.Password)); return fields; } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Tokens.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Tokens.cs ---- using System.Text.Json; namespace redb.Identity.Client; public partial interface IIdentityClient { /// List tokens, optionally filtered by subject (admin). Task ListTokensAsync(string? subject = null, int offset = 0, int count = 20, CancellationToken ct = default); /// Revoke a single token by id (admin). Task RevokeTokenAdminAsync(string tokenId, CancellationToken ct = default); /// Revoke all tokens for a subject (admin). Task RevokeTokensBySubjectAsync(IDictionary request, CancellationToken ct = default); /// Trigger pruning of expired tokens (admin, may be slow). Task PruneTokensAsync(CancellationToken ct = default); } public sealed partial class IdentityClient { private const string TokensAdminBase = "/api/v1/identity/tokens"; public async Task ListTokensAsync(string? subject = null, int offset = 0, int count = 20, CancellationToken ct = default) { var url = $"{TokensAdminBase}?offset={offset}&count={count}" + (subject is null ? "" : $"&subject={Uri.EscapeDataString(subject)}"); using var resp = await _http.GetAsync(url, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeTokenAdminAsync(string tokenId, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{TokensAdminBase}/{Uri.EscapeDataString(tokenId)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task RevokeTokensBySubjectAsync(IDictionary request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{TokensAdminBase}/revoke-by-subject", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task PruneTokensAsync(CancellationToken ct = default) { using var resp = await _http.PostAsync($"{TokensAdminBase}/prune", content: null, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Users.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Users.cs ---- using redb.Identity.Contracts.Common; using redb.Identity.Contracts.Users; namespace redb.Identity.Client; public partial interface IIdentityClient { Task> ListUsersAsync(int offset = 0, int count = 25, CancellationToken ct = default); Task GetUserAsync(string idOrLogin, CancellationToken ct = default); Task CreateUserAsync(CreateUserRequest request, CancellationToken ct = default); Task UpdateUserAsync(long id, UpdateUserRequest request, CancellationToken ct = default); Task DeleteUserAsync(string idOrLogin, CancellationToken ct = default); Task ChangeUserPasswordAsync(long id, ChangePasswordRequest request, CancellationToken ct = default); /// /// Admin-side password reset for the given user. Bypasses the OldPassword /// challenge that the regular change-password flow requires — operator's /// identity:users.manage / identity:manage scope IS the /// authorization. Revokes every existing session as a side effect. /// Task AdminResetUserPasswordAsync(long id, AdminResetPasswordRequest request, CancellationToken ct = default); Task> SearchUsersAsync(string query, CancellationToken ct = default); /// /// Paginated user search. Returns total match count + the requested page. /// Use this over the legacy non-paginated overload when the tenant may /// have more than the server-side per-page cap (200) matching the query. /// Task> SearchUsersPagedAsync(string query, int offset = 0, int count = 25, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string UsersBase = "/api/v1/identity/users"; public async Task> ListUsersAsync(int offset = 0, int count = 25, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{UsersBase}?offset={offset}&count={count}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetUserAsync(string idOrLogin, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{UsersBase}/{Uri.EscapeDataString(idOrLogin)}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateUserAsync(CreateUserRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(UsersBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateUserAsync(long id, UpdateUserRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{UsersBase}/{id}", request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task DeleteUserAsync(string idOrLogin, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{UsersBase}/{Uri.EscapeDataString(idOrLogin)}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task ChangeUserPasswordAsync(long id, ChangePasswordRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{UsersBase}/{id}/change-password", request, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task AdminResetUserPasswordAsync(long id, AdminResetPasswordRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{UsersBase}/{id}/admin-reset-password", request, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task> SearchUsersAsync(string query, CancellationToken ct = default) { var page = await SearchUsersPagedAsync(query, 0, 200, ct).ConfigureAwait(false); return page.Items; } public async Task> SearchUsersPagedAsync(string query, int offset = 0, int count = 25, CancellationToken ct = default) { var url = $"{UsersBase}/search?query={Uri.EscapeDataString(query)}&offset={offset}&count={count}"; using var resp = await _http.GetAsync(url, ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.Webhooks.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.Webhooks.cs ---- using redb.Identity.Client.Internal; using redb.Identity.Contracts.Common; using redb.Identity.Contracts.Webhooks; namespace redb.Identity.Client; public partial interface IIdentityClient { Task> ListWebhooksAsync(int offset = 0, int count = 25, CancellationToken ct = default); Task GetWebhookAsync(long id, CancellationToken ct = default); Task CreateWebhookAsync(CreateWebhookSubscriptionRequest request, CancellationToken ct = default); Task UpdateWebhookAsync(long id, UpdateWebhookSubscriptionRequest request, CancellationToken ct = default); Task DeleteWebhookAsync(long id, CancellationToken ct = default); Task RotateWebhookSecretAsync(long id, CancellationToken ct = default); } public sealed partial class IdentityClient { private const string WebhooksBase = "/api/v1/identity/webhooks"; public async Task> ListWebhooksAsync(int offset = 0, int count = 25, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{WebhooksBase}?offset={offset}&count={count}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync>(ct).ConfigureAwait(false); } public async Task GetWebhookAsync(long id, CancellationToken ct = default) { using var resp = await _http.GetAsync($"{WebhooksBase}/{id}", ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task CreateWebhookAsync(CreateWebhookSubscriptionRequest request, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync(WebhooksBase, request, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } public async Task UpdateWebhookAsync(long id, UpdateWebhookSubscriptionRequest request, CancellationToken ct = default) { using var resp = await _http.PutAsJsonAsync($"{WebhooksBase}/{id}", request, _json, ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task DeleteWebhookAsync(long id, CancellationToken ct = default) { using var resp = await _http.DeleteAsync($"{WebhooksBase}/{id}", ct).ConfigureAwait(false); await resp.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); } public async Task RotateWebhookSecretAsync(long id, CancellationToken ct = default) { using var resp = await _http.PostAsJsonAsync($"{WebhooksBase}/{id}/rotate-secret", new { }, _json, ct).ConfigureAwait(false); return await resp.ReadJsonAsync(ct).ConfigureAwait(false); } } Path: redb-identity/src/redb.Identity.Client/IdentityClient.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClient.cs ---- // IdentityClient is a sealed partial class. Domain-specific methods live in: // IdentityClient.Users.cs — users CRUD + group memberships // IdentityClient.Groups.cs — groups tree, members // IdentityClient.Applications.cs — OIDC applications // IdentityClient.Scopes.cs — scopes // IdentityClient.ClaimMappers.cs — claim mappers + claim scopes // IdentityClient.Federation.cs — federation providers // IdentityClient.Sessions.cs — admin sessions endpoint // IdentityClient.Tokens.cs — admin tokens endpoint // IdentityClient.Mfa.cs — admin MFA operations // IdentityClient.Audit.cs — audit log // IdentityClient.Account.cs — /me/* (profile, sessions, mfa, password, federated, consents) // IdentityClient.Token.cs — /connect/{token,introspect,revoke,userinfo} // IdentityClient.Scim.cs — /scim/v2/{Users,Groups,Bulk,ServiceProviderConfig} using System.Text.Json; using System.Text.Json.Serialization; using Microsoft.Extensions.Options; namespace redb.Identity.Client; public sealed partial class IdentityClient : IIdentityClient { private readonly HttpClient _http; private readonly IdentityClientOptions _opts; private readonly JsonSerializerOptions _json; // Protocol addresses (token, introspection, revocation, userinfo, discovery, JWKS) come from here, not from // BaseUrl: see IdentityClientOptions.Authority. private readonly AuthorityDiscovery _discovery; public IdentityClient(HttpClient http, IOptions opts) { _http = http; _opts = opts.Value; _discovery = new AuthorityDiscovery(http, _opts.Authority, ServiceCollectionExtensions.AuthorityOption); _json = new JsonSerializerOptions(JsonSerializerDefaults.Web) { PropertyNameCaseInsensitive = true, Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping, Converters = { new JsonStringEnumConverter() } }; } } Path: redb-identity/src/redb.Identity.Client/IdentityClientOptions.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/IdentityClientOptions.cs ---- namespace redb.Identity.Client; /// /// Configuration for redb.Identity.Client typed HttpClient SDK. /// public sealed class IdentityClientOptions { /// /// Base URL of the Identity management API (/api/v1/identity/*, e.g. https://id.example.org). With /// IdentityTransport:Http:ManagementPort set it is that port. No protocol endpoint is taken from here. /// public Uri BaseUrl { get; set; } = new("https://localhost/"); /// /// Required. The issuer of the Identity server, for example https://id.example.org; it may be the same /// address as . Every protocol address the client uses (token, introspection, revocation, /// userinfo, discovery, JWKS) comes from the discovery document at /// {Authority}/.well-known/openid-configuration, and from nowhere else. The document is read at the first /// use, not at start-up, and kept for the life of the client; when the server cannot be reached, that call fails /// and the next one reads the document again. /// public Uri? Authority { get; set; } /// Optional separate base for SCIM (defaults to + "/scim/v2"). public Uri? ScimBaseUrl { get; set; } /// Used by ClientCredentialsAccessTokenProvider (CLI / server-to-server). public string? ClientId { get; set; } /// Used by ClientCredentialsAccessTokenProvider (CLI / server-to-server). public string? ClientSecret { get; set; } /// /// Scopes requested by ClientCredentialsAccessTokenProvider. Defaults to identity:manage, the /// master management scope: it passes every management endpoint, reads and changes alike. The service account /// must be allowed to request it. A client that needs less can set a narrower scope instead, such as /// identity:read for read-only access or a resource scope like identity:users:read /// (see IdentityScopes in redb.Identity.Contracts). /// public string[] Scopes { get; set; } = ["identity:manage"]; /// Per-request timeout. Default 30s. public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(30); } Path: redb-identity/src/redb.Identity.Client/Internal/AuthorityDiscovery.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Internal/AuthorityDiscovery.cs ---- using System.Text.Json; namespace redb.Identity.Client.Internal; /// /// The one reader of the discovery document for every part of the client: the protocol addresses (token, /// introspection, revocation, userinfo, JWKS) come from {Authority}/.well-known/openid-configuration, never /// from the API base URL. The document is read at the first use and kept for the life of this instance; a failed /// read is not kept, so the next call reads it again. /// internal sealed class AuthorityDiscovery { private readonly HttpClient _http; private readonly SemaphoreSlim _lock = new(1, 1); private JsonElement? _document; public AuthorityDiscovery(HttpClient http, Uri? authority, string optionName) { _http = http; Authority = authority; OptionName = optionName; } /// The configured issuer; null when the option was not set. public Uri? Authority { get; } /// The option the issuer comes from, for the message when it is missing. public string OptionName { get; } /// The message every options validation and every unset use of the client gives. public static string MissingAuthorityMessage(string optionName) => $"{optionName} is required: set it to the issuer of the Identity server (the console reads it from " + "Identity:Authority). The token and the other protocol endpoints come from its discovery document, not from " + "BaseUrl."; /// The address of the discovery document. public Uri DocumentAddress => new( $"{(Authority ?? throw new InvalidOperationException(MissingAuthorityMessage(OptionName))).AbsoluteUri.TrimEnd('/')}" + "/.well-known/openid-configuration"); /// The discovery document, read once. public async Task GetDocumentAsync(CancellationToken ct = default) { if (_document is { } cached) return cached; await _lock.WaitAsync(ct).ConfigureAwait(false); try { if (_document is { } again) return again; using var resp = await _http.GetAsync(DocumentAddress, ct).ConfigureAwait(false); var document = await resp.ReadJsonAsync(ct).ConfigureAwait(false); _document = document.Clone(); return _document.Value; } finally { _lock.Release(); } } /// An absolute endpoint the discovery document names, such as token_endpoint. public async Task GetEndpointAsync(string name, CancellationToken ct = default) { var document = await GetDocumentAsync(ct).ConfigureAwait(false); if (document.TryGetProperty(name, out var value) && value.ValueKind == JsonValueKind.String && Uri.TryCreate(value.GetString(), UriKind.Absolute, out var endpoint)) { return endpoint; } throw new InvalidOperationException($"The discovery document at {DocumentAddress} names no absolute {name}."); } } Path: redb-identity/src/redb.Identity.Client/Internal/HttpResponseExtensions.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/Internal/HttpResponseExtensions.cs ---- using System.Net.Http.Json; using System.Text.Json; namespace redb.Identity.Client.Internal; /// /// Helpers used by partial methods to either throw on /// non-success responses (parsing RFC 7807 problem details when present) or /// deserialize a JSON success body. /// internal static class HttpResponseExtensions { private static readonly JsonSerializerOptions Json = new(JsonSerializerDefaults.Web) { PropertyNameCaseInsensitive = true, Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping, }; public static async Task EnsureSuccessOrThrowAsync( this HttpResponseMessage response, CancellationToken ct = default) { if (response.IsSuccessStatusCode) return; ProblemDetails? pd = null; string? raw = null; try { raw = await response.Content.ReadAsStringAsync(ct).ConfigureAwait(false); var mediaType = response.Content.Headers.ContentType?.MediaType; if (!string.IsNullOrWhiteSpace(raw) && (mediaType == "application/problem+json" || mediaType == "application/json")) { pd = JsonSerializer.Deserialize(raw, Json); } } catch { // Body unreadable / not JSON — fall through to bare exception. } var msg = pd?.Title ?? pd?.Detail ?? (string.IsNullOrWhiteSpace(raw) ? $"HTTP {(int)response.StatusCode} {response.ReasonPhrase}" : $"HTTP {(int)response.StatusCode} {response.ReasonPhrase}: {Truncate(raw, 400)}"); throw new ApiException(response.StatusCode, msg, pd, raw); } private static string Truncate(string s, int max) => s.Length <= max ? s : s[..max] + "…"; public static async Task ReadJsonAsync( this HttpResponseMessage response, CancellationToken ct = default) { await response.EnsureSuccessOrThrowAsync(ct).ConfigureAwait(false); try { var result = await response.Content.ReadFromJsonAsync(Json, ct).ConfigureAwait(false); return result ?? throw new ApiException( response.StatusCode, "Empty response body", null, null); } catch (JsonException ex) { throw new ApiException( response.StatusCode, $"Failed to deserialize response body as {typeof(T).Name}: {ex.Message}", null, null, ex); } } } Path: redb-identity/src/redb.Identity.Client/ServiceCollectionExtensions.cs Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/ServiceCollectionExtensions.cs ---- using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using redb.Identity.Client.Auth; namespace redb.Identity.Client; /// /// DI extensions for registering and the optional /// (for CLI / server-to-server scenarios). /// public static class ServiceCollectionExtensions { internal const string AuthorityOption = "IdentityClientOptions.Authority"; /// /// Register as a typed . /// Note: is NOT registered here — consumer must /// supply it (Web → HttpContext-based, CLI → ). /// public static IServiceCollection AddIdentityClient( this IServiceCollection services, Action configure) { services.AddOptions() .Configure(configure) .Validate(o => o.Authority is { IsAbsoluteUri: true }, AuthorityDiscovery.MissingAuthorityMessage(AuthorityOption)) .ValidateOnStart(); services.AddTransient(); services.AddHttpClient((sp, http) => { var opts = sp.GetRequiredService>().Value; http.BaseAddress = opts.BaseUrl; http.Timeout = opts.Timeout; http.DefaultRequestHeaders.Accept.Add( new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); }) .AddHttpMessageHandler(); return services; } /// /// Register as the /// implementation. Use for CLI / server-to-server. /// public static IServiceCollection AddClientCredentialsTokenProvider(this IServiceCollection services) { services.AddHttpClient(); services.AddSingleton(sp => sp.GetRequiredService()); return services; } } Path: redb-identity/src/redb.Identity.Client/redb.Identity.Client.csproj Snapshot: redb-identity, 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-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/src/redb.Identity.Client/redb.Identity.Client.csproj ---- redb.Identity.Client redb.Identity.Client redb.Identity.Client Typed HTTP SDK for redb.Identity (admin/account/token/scim).