string Realm { get; set; }
Source
Gets or sets the local Keycloak realm name.
Captures safe readiness evidence for the AppSurface Keycloak local proof.
Authority
ClientId
Realm
Configures the deterministic local Keycloak realm and public client used for AppSurface OIDC proof AppHosts.
void Validate()
Validates all local Keycloak proof options and populates default redirect URIs when needed.
AppSurfaceKeycloakConfigurationProjection CreateConfigurationProjection()
Builds the secret-safe configuration projection for the paired web proof.
An immutable projection containing only allowlisted OIDC configuration.
string Realm { get; set; }
Source
Gets or sets the local Keycloak realm name.
string ClientId { get; set; }
Source
Gets or sets the local public OIDC client id.
string ClientDisplayName { get; set; }
Source
Gets or sets the local display name imported for the OIDC client.
string CallbackPath { get; set; }
Source
Gets or sets the OIDC callback path used by the web proof.
string SignedOutCallbackPath { get; set; }
Source
Gets or sets the OIDC signed-out callback path used by the web proof.
int KeycloakPort { get; set; }
Source
Gets or sets the fixed local Keycloak host port.
int WebProofPort { get; set; }
Source
Gets or sets the fixed local web proof port used to build redirect URIs.
bool UsePersistentDataVolume { get; set; }
Source
Gets or sets a value indicating whether Keycloak data should persist in a container volume.
Disposable data is the default so realm import is deterministic. Persistent data keeps admin credentials and imported realm state until the volume is deleted.
string RealmImportDirectory { get; set; }
Source
Gets or sets the directory that receives generated Keycloak realm import JSON.
AppSurfaceKeycloakThemeOptions? LoginTheme { get; set; }
Source
Gets or sets the optional application-owned login theme used by the local Keycloak AppHost proof.
When absent, Keycloak's existing behavior and the package's original five-minute proof remain unchanged. When present, the package validates and read-only mounts the theme only for local AppHost use; it does not publish an image or mutate a production realm.
IList<Uri> RedirectUris { get; }
Source
Gets mutable redirect URIs imported into the public OIDC client.
IList<Uri> PostLogoutRedirectUris { get; }
Source
Gets mutable post-logout redirect URIs imported into the public OIDC client.
IList<AppSurfaceKeycloakUserOptions> SeededUsers { get; }
Source
Gets mutable local-only users imported into the proof realm.
Represents a safe AppSurface Keycloak proof diagnostic with a stable code.
string Code { get; }
Source
Gets the stable AppSurface Keycloak diagnostic code.
Identifies one registered finite consumer project in an AppSurface local Keycloak seed chain.
string Name { get; }
Source
Gets the caller-supplied stage name.
IResourceBuilder<ProjectResource> Resource { get; }
Source
Gets the consumer-owned finite project resource.
Applications may make their own resources wait for this completion handle, but the normal next seed should be registered through AppSurfaceKeycloakResource.WithLocalSeed
with AppSurfaceKeycloakLocalSeedOptions.After
so the package can validate the linear chain.
Generates deterministic Keycloak realm import JSON for the AppSurface local proof.
string Generate(AppSurfaceKeycloakOptions options)
Generates deterministic realm import JSON from validated options.
options
A JSON document suitable for Keycloak startup realm import.
string WriteRealmImport(AppSurfaceKeycloakOptions options)
Writes deterministic realm import JSON into the configured import directory.
options
The written realm import file path.
Action<string>? BeforeMoveForTesting { get; set; }
Source
Gets or sets a test-only action invoked after temporary realm evidence is written and immediately before its atomic replacement.
The action is stored in AsyncLocal<Action<string>>
so parallel test flows remain isolated. Tests must reset this property to null
after use.
Exposes secret-safe evidence for a validated Keycloak login theme registration.
Name
BaseImage
Platform
ManifestDigest
TemplateBaselineDigest
Holds validated theme-registration state, including the resolved source directory and development-only paths that are excluded from immutable image evidence.
SourceDirectory
Manifest
BaseImage
TemplateBaselineDigest
DevelopmentOnlyResourcePaths
Registration
Represents the finite AppHost resource that proves an AppSurface local Keycloak realm is ready for dependent work.
The package owns only this baseline proof. Provider administration, client creation, broker policy, credentials, mutations, retries, and convergence remain the responsibility of the consumer-owned finite project that waits for Resource
to complete.
IResourceBuilder<ExecutableResource> Resource { get; }
Source
Gets the completion-bearing Aspire executable resource.
Depend on this resource through Aspire's WaitForCompletion
relationship. A dependent project starts only after the realm-ready process exits successfully.
Creates and verifies a deterministic, immutable-image-ready Keycloak login-theme build context.
This contract materializes a validated source snapshot, a Containerfile, and secret-safe manifest metadata. The application or its CI system owns the actual image build, registry push, deployment, and production realm update.
AppSurfaceKeycloakThemeBuildContract Create(AppSurfaceKeycloakThemeOptions theme)
Creates a deterministic build contract from a configured login theme.
theme
A build contract that owns only the materialized local snapshot.
string Write(string buildContextDirectory)
Writes an immutable-image-ready snapshot to a new directory.
buildContextDirectory
The absolute build context directory.
AppSurfaceKeycloakException
void VerifyPackagedTheme(string packagedThemeDirectory)
Verifies that a materialized or extracted image theme directory exactly matches this contract's manifest.
packagedThemeDirectory
/opt/keycloak/themes/{name}
.AppSurfaceKeycloakException
PackagedManifest
.string CreateContainerfile()
Creates the deterministic Containerfile content for the materialized snapshot.
The image build instructions without machine-local source paths.
AppSurfaceKeycloakThemeRegistration Registration { get; }
Source
Gets secret-safe evidence for the registered login theme.
AppSurfaceKeycloakThemeManifest Manifest { get; }
Source
Gets the deterministic source manifest used by this build contract.
AppSurfaceKeycloakThemeManifest PackagedManifest { get; }
Source
Gets the deterministic manifest for the immutable image context after development-only resources are excluded.
Manifest
retains the complete validated local source manifest. Use this property to prove the packaged image content that Write(string)
materializes and VerifyPackagedTheme(string)
validates.
string Digest { get; }
Source
Gets the deterministic digest that binds the registration, source manifest, packaged manifest, and inputs used to derive the Containerfile.
Configures an application-owned Keycloak login theme for a local AppHost proof.
This configuration affects only the AppHost resource. It does not build, publish, deploy, or administer a production Keycloak image or realm. The source directory must contain a Keycloak theme root with login/theme.properties
.
AppSurfaceKeycloakThemeOptions Login(string name, string sourceDirectory, AppSurfaceKeycloakImageReference baseImage)
Creates an assets-only or inherited-template login-theme configuration.
name
sourceDirectory
login
theme subtree.baseImage
A configurable login-theme instance.
void Validate()
Validates the theme source and declared resource/property requirements using the AppHost process base directory.
string Name { get; set; }
Source
Gets or sets the lower-case Keycloak login theme name.
string SourceDirectory { get; set; }
Source
Gets or sets the directory containing the theme's login
subtree.
Relative paths are resolved once against the AppHost process base directory before validation and mounting. The resolved path is never exposed through the safe resource registration.
AppSurfaceKeycloakImageReference BaseImage { get; set; }
Source
Gets or sets the immutable Keycloak base image used by local theme proof.
string Platform { get; set; }
Source
Gets or sets the platform for exact-image evidence.
Version one supports linux/amd64
exact runtime proof. Other platforms can use deterministic source validation, but must not claim the exact-image release proof.
string? TemplateBaselineDirectory { get; set; }
Source
Gets or sets the directory holding the reviewed upstream FreeMarker baseline for copied template overrides.
A source tree containing .ftl
files must declare this directory. It contains only the expected slash-relative upstream template files and its digest is emitted as evidence beside the pinned image identity.
IList<string> RequiredThemeProperties { get; }
Source
Gets property names that must occur in login/theme.properties
without retaining their values in evidence.
IList<string> RequiredResourcePaths { get; }
Source
Gets source-relative resources that must exist in the deterministic manifest.
IList<string> DevelopmentOnlyResourcePaths { get; }
Source
Gets source-relative resources used only by the development bind mount.
This declaration is validated but does not make an asset eligible for a future packaged-image proof.
Defines the nonsecret environment contract for the package-owned realm-ready executable.
Represents an immutable container image reference used to prove a Keycloak login theme.
Theme verification is meaningful only when it is associated with a concrete Keycloak image. This type requires a registry, tag, and SHA-256 digest so a moving tag cannot silently change the template baseline beneath a theme.
AppSurfaceKeycloakImageReference Parse(string value)
Parses a fully-qualified immutable container image reference.
value
registry/repository:tag@sha256:<64 lowercase hex characters>
form.The parsed image reference.
AppSurfaceKeycloakException
string Registry { get; }
Source
Gets the container registry, including an optional port.
string Image { get; }
Source
Gets the slash-separated repository name without the registry.
string Tag { get; }
Source
Gets the immutable-reference tag retained for human-readable evidence.
string Sha256 { get; }
Source
Gets the lowercase hexadecimal SHA-256 image digest without the sha256:
prefix.
string Value { get; }
Source
Gets the canonical registry, image, tag, and digest reference.
Performs bounded, multi-signal readiness checks for the AppSurface local Keycloak proof.
Task<AppSurfaceKeycloakReadinessResult> CheckOnceAsync(CancellationToken cancellationToken = default)
Checks metadata, generated realm evidence, and authorization challenge evidence once.
cancellationToken
A successful readiness result.
Represents the secret-safe tuple that binds a packaged Keycloak login theme to the images and manifests it was verified against.
AppSurfaceKeycloakThemeReleaseEvidence Create(AppSurfaceKeycloakThemeBuildContract buildContract, string finalImage)
Creates release evidence from a verified build contract and the digest-pinned image that packages its theme.
buildContract
finalImage
A portable evidence tuple without source paths, realm imports, credentials, or property values.
void Verify(AppSurfaceKeycloakThemeBuildContract buildContract, string finalImage)
Verifies that this evidence still represents the supplied build contract and final image reference.
buildContract
finalImage
AppSurfaceKeycloakException
void VerifyObservedImage(ForgeTrust.AppSurface.Auth.Keycloak.VerifiedKeycloakImageEvidence observed)
Requires actual observed image evidence for this theme release tuple.
observed
AppSurfaceKeycloakException
Requires image/platform binding, exact theme inventory, and an actual hash observation for every packaged member.
string Write(string outputFile)
Atomically writes this release tuple to an application-owned evidence file.
outputFile
The absolute evidence file path.
AppSurfaceKeycloakException
Action<string>? BeforeMoveForTesting { get; set; }
Source
Gets or sets a test-only action invoked after temporary evidence is written and immediately before its atomic move into place.
The action is stored in AsyncLocal<Action<string>>
so parallel test flows remain isolated. Tests must reset this property to null
after use.
string Schema { get; }
Source
Gets the versioned evidence schema name.
string ThemeName { get; }
Source
Gets the registered Keycloak login theme name.
string SourceManifestDigest { get; }
Source
Gets the complete validated source-manifest digest.
string PackagedManifestDigest { get; }
Source
Gets the immutable image-context manifest digest.
string BuildContractDigest { get; }
Source
Gets the digest of the generated build contract.
string KeycloakBaseImage { get; }
Source
Gets the digest-pinned Keycloak base-image reference.
string FinalImage { get; }
Source
Gets the digest-pinned image that contains the packaged theme.
string Platform { get; }
Source
Gets the verified container platform.
string? TemplateBaselineDigest { get; }
Source
Gets the optional reviewed FreeMarker baseline digest.
Secret-safe app configuration produced by the AppSurface Keycloak proof package.
The projection only contains OIDC authority, client id, callback paths, and the public-client secret policy. It never contains admin credentials, seeded user passwords, realm JSON, tokens, raw claims, or client secrets.
IResourceBuilder<ProjectResource> ApplyTo(IResourceBuilder<ProjectResource> project)
Applies the allowlisted environment variables to an Aspire project resource.
project
The same project resource builder for chaining.
string Authority { get; }
Source
Gets the local Keycloak realm authority.
string ClientId { get; }
Source
Gets the local public client id.
string CallbackPath { get; }
Source
Gets the OIDC callback path.
string SignedOutCallbackPath { get; }
Source
Gets the OIDC signed-out callback path.
bool RequireClientSecret { get; }
Source
Gets a value indicating whether the paired proof app should require a client secret.
IReadOnlyDictionary<string, string> EnvironmentVariables { get; }
Source
Gets the allowlisted environment variables used by the proof web app.
Wraps the official Aspire Keycloak resource with AppSurface local proof metadata.
AppSurfaceKeycloakRealmReady RealmReady()
Gets the lazily registered finite resource that proves the local Keycloak realm baseline is ready.
A cached completion-bearing resource that consumers can use as the first dependency for local seed projects.
AppSurfaceKeycloakException
AddAppSurfaceKeycloak(...)
or the package-owned worker cannot be resolved.The returned resource waits for the official Keycloak resource to become healthy, then performs the package's bounded metadata, generated-realm, and public authorization-challenge checks in a separate finite process. It performs no Keycloak administration and receives no credentials. Calling this method repeatedly for the same wrapper returns the same resource and never adds a second gate to the AppHost graph.
AppSurfaceKeycloakLocalSeed WithLocalSeed(string name, Func<AppSurfaceKeycloakLocalSeedContext, IResourceBuilder<ProjectResource>> factory, Action<AppSurfaceKeycloakLocalSeedOptions>? configure = null)
Registers one finite, consumer-owned project that seeds local Keycloak-adjacent state after baseline realm readiness.
name
factory
ProjectResource
using the supplied safe context.configure
The registered local seed handle, including its consumer-owned project resource.
AppSurfaceKeycloakException
Registration is permitted only while the AppHost executes Run
in Development
, Test
, or Testing
by default. The first seed waits for RealmReady
. Each later seed must nominate the immediately previous handle via AppSurfaceKeycloakLocalSeedOptions.After
; this intentionally creates one linear, observable completion chain. The package never starts a callback runner or performs Keycloak administration. The factory owns the actual client, mutation, retry, idempotence, and finite exit code.
IResourceBuilder<KeycloakResource> Resource { get; }
Source
Gets the underlying Aspire Keycloak resource builder for normal Aspire APIs such as WithReference
and WaitFor
.
AppSurfaceKeycloakConfigurationProjection Configuration { get; }
Source
Gets the secret-safe web configuration projection.
AppSurfaceKeycloakReadinessProbe Readiness { get; }
Source
Gets the readiness probe.
string RealmImportFile { get; }
Source
Gets the generated realm import file path.
AppSurfaceKeycloakThemeRegistration? Theme { get; }
Source
Gets secret-safe evidence for the optional local login theme.
Represents deterministic, secret-safe evidence for a Keycloak login theme source tree.
The manifest contains normalized relative paths, byte lengths, and content digests. It intentionally omits source machine paths and file contents so it can be retained as safe build evidence.
AppSurfaceKeycloakThemeManifest Create(string themeName, string sourceDirectory)
Creates a deterministic manifest for a resolved Keycloak theme source directory.
themeName
sourceDirectory
login
directory.A deterministic manifest with ordinally sorted entries.
Represents one normalized, content-addressed file in a Keycloak login theme manifest.
RelativePath
Length
Sha256
Validates local seed registration before a consumer project can be launched.
Default local-only values used by the AppSurface Keycloak AppHost proof package.
These defaults intentionally mirror the AppSurface OIDC package callback paths without taking a runtime dependency on that package. Drift is covered by tests so the AppHost proof package does not become part of web auth registration.
string Authority(string realm = Realm, int port = KeycloakPort)
Builds the default authority URL for a local realm and port.
realm
port
The local HTTPS authority URL.
string SeededUserEmail(string username)
Builds the default verified email address for a locally seeded Keycloak proof user.
username
The local-only email address for the user.
Resolves the framework-dependent executable payload for a package or project-reference AppHost.
Holds one resolved command invocation without exposing the local payload path as a public API.
Holds the safe, immutable inputs needed to materialize the package-owned realm-ready executable.
Configures the explicit local-only policy, predecessor, and typed secret bindings for one consumer seed project.
AppSurfaceKeycloakLocalSeedOptions After(AppSurfaceKeycloakLocalSeed predecessor)
Requires this seed to follow the immediately preceding local seed returned by the same Keycloak wrapper.
predecessor
This options instance for fluent configuration.
AppSurfaceKeycloakLocalSeedOptions WithRequiredSecretParameter(string environmentVariableName, IResourceBuilder<ParameterResource> parameter)
Binds one required Aspire secret parameter only to this seed's consumer project.
environmentVariableName
parameter
ParameterResource.Secret
flag is true.This options instance for fluent configuration.
AppSurface validates parameter identity and secret metadata only; it never reads, logs, writes, serializes, or otherwise resolves the parameter value. The parameter may not be reused by a second seed in the same wrapper.
IList<string> AllowedEnvironmentNames { get; }
Source
Gets local environment names in which seed registration is allowed, compared case-insensitively.
The default is Development
, Test
, and Testing
. Publish and every execution operation other than Aspire Run
are always denied, even when this list contains a deployment-like environment.
Stores a declared typed secret binding until the parent resource validates and applies it to the consumer project.
Stable diagnostic codes emitted by the AppSurface Keycloak AppHost proof package.
Resolves safe local paths for generated Keycloak realm import artifacts.
string GetDefaultImportDirectory()
Gets the default realm import directory without creating it.
The default directory beneath the application base directory.
string ResolveImportDirectory(string rootDirectory, string resourceName)
Resolves a resource-specific realm import directory without creating it.
rootDirectory
resourceName
The resolved import directory.
string GetRealmImportFilePath(string realmImportDirectory, string realm)
Resolves the generated realm import file beneath an import directory.
realmImportDirectory
realm
The safe realm import file path.
Adds AppSurface local Keycloak proof resources to Aspire AppHosts.
AppSurfaceKeycloakResource AddAppSurfaceKeycloak(this IDistributedApplicationBuilder builder, string name = AppSurfaceKeycloakDefaults.ResourceName, Action<AppSurfaceKeycloakOptions>? configure = null)
Adds an official Aspire Keycloak resource configured with deterministic AppSurface local OIDC proof defaults.
builder
name
configure
An AppSurface wrapper exposing the underlying Keycloak resource, secret-safe config projection, and readiness probe.
AppSurfaceKeycloakResource AddAppSurfaceKeycloak(this IDistributedApplicationBuilder builder, string name, IResourceBuilder<ParameterResource> adminUsername, IResourceBuilder<ParameterResource> adminPassword, Action<AppSurfaceKeycloakOptions>? configure = null)
Adds an official Aspire Keycloak resource configured with deterministic AppSurface local OIDC proof defaults and explicit typed administrator parameters for finite consumer-owned local seed projects.
builder
name
adminUsername
adminPassword
configure
An AppSurface wrapper exposing the underlying Keycloak resource, secret-safe config projection, and readiness probe.
Use this overload only when a consumer-owned local seed must authenticate to the Keycloak Admin API. AppSurface does not read either parameter value. A seed receives the password only through AppSurfaceKeycloakLocalSeedOptions.WithRequiredSecretParameter
and owns all administration work.
Runs the package-owned finite readiness verification process.
Reconstructs validated probe inputs from the explicit nonsecret executable environment contract.
Supplies a local seed factory with the safe Keycloak metadata and resource name it may bind to its own project.
This context never carries Keycloak administrator credentials, client secrets, tokens, claims, external subjects, seeded-user passwords, provider responses, or consumer state. Bind a required consumer credential through AppSurfaceKeycloakLocalSeedOptions.WithRequiredSecretParameter
instead.
string ResourceName { get; }
Source
Gets the exact required name for the consumer project resource.
string Authority { get; }
Source
Gets the safe local realm authority.
string RealmName { get; }
Source
Gets the safe local realm name.
string PublicClientId { get; }
Source
Gets the safe public OIDC client identifier.
Describes a deterministic local-only user imported into the AppSurface Keycloak proof realm.
void Validate()
Validates the seeded user's username, subject, password, display name, and claim entries.
AppSurfaceKeycloakException
string Username { get; }
Source
Gets the local Keycloak username.
string Password { get; }
Source
Gets the temporary local-only password used by Keycloak realm import.
This value is intentionally never included in runtime app configuration projection.
string Subject { get; }
Source
Gets the stable OIDC subject value.
string DisplayName { get; }
Source
Gets the local display name used by the proof UI.
IDictionary<string, string> Claims { get; }
Source
Gets local-only user attributes that should be imported and optionally mapped to claims.
Provides early local fixed-port diagnostics before Aspire starts containers or projects.
void ThrowIfOccupied(int port, string optionName)
Throws a safe diagnostic when a configured fixed port is already occupied.
port
optionName
bool IsAvailable(int port)
Returns whether a local TCP port can be bound at preflight time.
port
true
when the port can be bound; otherwise false
.
Hosts the package's finite realm-ready executable mode.