Secrets, tenants, and identity
This page explains how Elsa identifies a tenant, carries that tenant through a request, authenticates users and applications, protects access with role-based permissions, and manages values that workflows must not store in plain text. These services form a trust boundary around workflow data and also support short-lived links that can start or resume selected workflow work.
The wider security model is described in Security and multitenancy. For sign-in through an outside identity provider, see External authentication.
Tenant context
Tenant context tells the rest of the system which customer or logical partition owns the current operation. A tenant has an ID, a name, and optional tenant configuration; the default tenant uses an empty ID, while the special * ID represents data that is available to all tenants. src/…/Tenant.cs• L7-37, src/…/Entity.cs• L6-16
Tenant sources
The tenant service can obtain the set of known tenants from configuration or from a tenant store. Configuration is useful for a fixed set of tenants and refreshes the active set when its options change. Store-backed tenants support managed tenant records and follow the persistence choice made by the host. Hosts can manage store-backed tenants through the tenant API and refresh the active registry after a change. src/…/ConfigurationTenantsProvider.cs• L10-69, src/…/StoreTenantsProvider.cs• L6-17, src/…/Endpoint.cs• L10-29, src/…/Endpoint.cs• L9-34
Tenant administration is itself protected by the tenants resource. The catalog exposes view, write, delete, and refresh actions, so a caller needs an explicit grant to change the set of tenants or reload it. src/…/TenantPermissions.cs• L7-25
References: src/…/ConfigurationTenantsProvider.cs• L10-69 src/…/StoreTenantsProvider.cs• L6-17 src/…/Endpoint.cs• L10-29 src/…/Endpoint.cs• L9-34 src/…/TenantPermissions.cs• L7-25
Tenant resolution pipeline
Tenant resolution is a chain of strategies that tries to map the current operation to one known tenant. The pipeline loads the tenant set first, gives each strategy a lookup context, and stops when a strategy returns a tenant ID that exists in that set. If no strategy resolves a tenant, the operation has no selected tenant; a strategy that returns an unknown ID does not create a tenant. src/…/TenantResolutionPipelineBuilder.cs• L7-46, src/…/DefaultTenantResolverPipelineInvoker.cs• L8-41
The base configuration uses the default tenant strategy. Hosts can replace or extend the pipeline when they need tenant selection from a request, a logged-in user, or another trusted source. src/…/MultitenancyOptions.cs• L5-14, src/…/DefaultTenantResolver.cs• L3-17
References: src/…/TenantResolutionPipelineBuilder.cs• L7-46 src/…/DefaultTenantResolverPipelineInvoker.cs• L8-41 src/…/MultitenancyOptions.cs• L5-14 src/…/DefaultTenantResolver.cs• L3-17
HTTP tenant resolution
The ASP.NET Core tenant service connects HTTP requests to the common tenant pipeline. It can select a tenant from a route prefix, the request host, or a configured request header. The route-prefix mode also removes the tenant prefix before the rest of the HTTP endpoint system handles the request, so tenant routing and endpoint URLs stay aligned. src/…/MultitenantHttpRoutingFeature.cs• L13-57, src/…/TenantResolutionMiddleware.cs• L7-49
The default header name is X-Tenant-Id. Host and route-prefix matching use tenant HTTP settings, which come from the tenant's configuration. src/…/MultitenancyHttpOptions.cs• L3-6, src/…/HeaderTenantResolver.cs• L8-24, src/…/HostTenantResolver.cs• L6-29, src/…/RoutePrefixTenantResolver.cs• L9-68, src/…/TenantExtensions.cs• L5-16
The request flow is therefore:
flowchart LR
Request[HTTP request] --> Strategies[Header, host, or route strategy]
Strategies --> Known[Known tenant set]
Known --> Scope[Tenant scope]
Scope --> Endpoint[HTTP endpoint and downstream services]
References: src/…/MultitenantHttpRoutingFeature.cs• L13-57 src/…/TenantResolutionMiddleware.cs• L7-49 src/…/MultitenancyHttpOptions.cs• L3-6 src/…/HeaderTenantResolver.cs• L8-24 src/…/HostTenantResolver.cs• L6-29 src/…/RoutePrefixTenantResolver.cs• L9-68
Tenant scope
A tenant scope makes the resolved tenant available to the current request or background operation. It sets the current tenant and creates a matching service scope, then restores the prior tenant when the work ends. This lets tenant-aware services use the same context without passing a tenant argument through every call. src/…/ITenantAccessor.cs• L1-14, src/…/TenantScope.cs• L5-23, src/…/DefaultTenantScopeFactory.cs• L3-11
Identity records use this context when they are created or queried. For example, a new user receives the current tenant ID, while user and role lists filter by the current tenant and still include tenant-agnostic roles where supported. Role names are unique within a tenant, while role IDs remain unique across a shared store. A tenant-owned role takes precedence when a name also exists on a tenant-agnostic role. src/…/UserManager.cs• L12-45, src/…/RoleFilter.cs• L21-66, src/…/RoleStoreExtensions.cs• L14-79, src/…/RoleManager.cs• L12-16
References: src/…/ITenantAccessor.cs• L1-14 src/…/TenantScope.cs• L5-23 src/…/DefaultTenantAccessor.cs• L6-22 src/…/DefaultTenantScopeFactory.cs• L3-11 src/…/UserManager.cs• L12-45 src/…/RoleFilter.cs• L21-66 src/…/RoleStoreExtensions.cs• L14-79 src/…/RoleManager.cs• L12-16
Identity and authorization
Identity gives Elsa a way to recognize users and applications and to issue credentials for later requests. Authorization then uses the permissions carried by that identity to decide which security and workflow actions are allowed.
Identity records
Users are named identities with password material and role links. Roles group permission names, so a change to a role can change the actions available to every user that has that role. Providers can read these records from stores or from configuration, which lets a host choose between managed identity data and a simpler fixed setup. src/…/User.cs• L5-29, src/…/Role.cs• L5-19, src/…/IdentityFeature.cs• L45-111
The identity feature also supports applications and API keys. Application keys gain permissions through their assigned roles, while an explicitly configured admin key can provide a separate bootstrap or break-glass identity with its configured permissions. Application credentials and user passwords are stored as hashes rather than as reusable plain text. src/…/DefaultApiKeyProvider.cs• L31-54, src/…/AdminApiKeyProvider.cs• L34-55, src/…/README.md• L104-120
References: src/…/User.cs• L5-29 src/…/Role.cs• L5-19 src/…/IdentityFeature.cs• L45-111 src/…/DefaultApiKeyProvider.cs• L31-54 src/…/AdminApiKeyProvider.cs• L34-55 src/…/README.md• L104-120
Identity bootstrap
An instance with no users needs an explicit first-access path. Elsa supports a seeded administrator or an explicitly configured admin API key, and it reports the missing bootstrap setup at startup instead of using a network-location shortcut. The seeded administrator runs for each activated tenant when its role configuration is present. It creates a tenant-owned role with a generated ID when needed, adds missing configured permissions, and creates the user only when both user credentials are configured. src/…/IdentityBootstrapDiagnostic.cs• L11-25, src/…/IdentityBootstrapDiagnostic.cs• L35-67, src/…/AdminUserInitializer.cs• L12-19, src/…/AdminUserInitializer.cs• L30-103, src/…/README.md• L11-17, src/…/README.md• L93-103
The initializer leaves an existing user unchanged and does not remove permissions from an existing admin role. It skips tenant-agnostic roles, so bootstrap does not widen a role shared by every tenant. The admin key can create the users, roles, and applications needed to move to normal identity access. src/…/AdminUserInitializer.cs• L42-77, src/…/AdminUserInitializer.cs• L105-122, src/…/README.md• L95-112
The admin API key is disabled unless a host configures one. When enabled, it replaces application API-key validation, so it should be treated as a temporary bootstrap credential rather than a permanent client credential. src/…/AdminApiKeyProvider.cs• L10-19, src/…/README.md• L104-116
References: src/…/IdentityBootstrapDiagnostic.cs• L11-25 src/…/IdentityBootstrapDiagnostic.cs• L35-67 src/…/AdminUserInitializer.cs• L12-19 src/…/AdminUserInitializer.cs• L30-103 src/…/AdminUserInitializer.cs• L105-122 src/…/AdminApiKeyProvider.cs• L10-19 src/…/README.md• L11-17 src/…/README.md• L93-116
Authentication tokens
The built-in login flow checks user credentials and returns an access token plus a refresh token. The token service signs both tokens with the configured issuer, audience, and signing key; it includes the stable user identity, roles, permissions, and tenant claim so later requests can recover the same security context. src/…/DefaultAccessTokenIssuer.cs• L40-62, src/…/DefaultElsaTokenService.cs• L18-92
Access and refresh tokens have different uses and lifetimes. Validation checks the signature, issuer, audience, lifetime, and token-use claim. A refresh request reads the user from the token subject, restores the tenant from the token, and issues a new pair of tokens for the same sign-in session. src/…/IdentityTokenOptions.cs• L55-107, src/…/DefaultIdentityRefreshTokenService.cs• L23-57, src/…/RefreshTokenSubject.cs• L20-43
The default ASP.NET Core authentication feature accepts either a JWT bearer token or an API key in the authorization header. Hosts can replace the API key provider and can choose how the root security policy is bootstrapped. Current management access is based on endpoint permissions rather than the retired SecurityRoot policy. src/…/DefaultAuthenticationFeature.cs• L16-24, src/…/DefaultAuthenticationFeature.cs• L37-47, src/…/DefaultAuthenticationFeature.cs• L95-121, src/…/README.md• L11-17
The signing key is a deployment secret. Production startup rejects a missing key, a short key, or a known public default. src/…/README.md• L3-9
References: src/…/DefaultAccessTokenIssuer.cs• L40-62 src/…/DefaultElsaTokenService.cs• L18-92 src/…/IdentityTokenOptions.cs• L55-107 src/…/DefaultIdentityRefreshTokenService.cs• L23-57 src/…/RefreshTokenSubject.cs• L20-43 src/…/DefaultAuthenticationFeature.cs• L95-121 src/…/README.md• L3-17
Sign-in sessions
A sign-in session groups the refresh tokens issued from one login. Each refresh token carries the session ID and the latest refresh-token expiry for that session, so a later refresh continues the same revocation boundary instead of creating an independent session. src/…/SignInSession.cs• L3-11, src/…/CustomClaimTypes.cs• L18-29, src/…/DefaultElsaTokenService.cs• L26-42
Logout revokes the session named by the caller's refresh token. It checks that the token belongs to the current user and tenant, accepts an expired refresh token when it can still identify the session, and leaves already issued access tokens valid until they expire. Refresh-token authentication rejects a revoked session before issuing another pair. src/…/Endpoint.cs• L12-64, src/…/IdentityTokenOptions.cs• L61-92, src/…/SessionRevoker.cs• L16-84
Session revocations are checked before tenant resolution, so their records are tenant-agnostic and session IDs must be unique across tenants. The default in-memory store loses revocations on restart and does not share them between nodes; deployed multi-node hosts need a durable shared store when logout must have that reach. src/…/RevokedSession.cs• L5-23, src/…/MemoryRevokedSessionStore.cs• L7-10, src/…/IRevokedSessionStore.cs• L5-25
References: src/…/SignInSession.cs• L3-11 src/…/CustomClaimTypes.cs• L18-29 src/…/DefaultElsaTokenService.cs• L26-42 src/…/Endpoint.cs• L12-64 src/…/IdentityTokenOptions.cs• L61-92 src/…/SessionRevoker.cs• L16-84 src/…/RevokedSession.cs• L5-23 src/…/MemoryRevokedSessionStore.cs• L7-10 src/…/IRevokedSessionStore.cs• L5-25
Permission authorization
Permissions are named capabilities in the form of a resource and an action. Roles provide these capabilities to users and applications, while endpoint declarations enforce them on the server. Identity exposes stable resources for users, roles, and applications; tenants and secrets expose their own resource catalogs. src/…/IdentityPermissions.cs• L7-31, src/…/TenantPermissions.cs• L7-25, src/…/SecretsResourcePermissions.cs• L7-25
Role changes use two checks. The caller must have permission to manage roles, and the caller must already hold every permission that the new or changed role would grant. Role creation first rejects permissions that the catalog cannot describe, then applies this anti-escalation check. The containment check means wildcard grants can delegate the resources they cover, while malformed or unknown grants cannot be delegated. src/…/RoleAuthorizationService.cs• L10-66, src/…/Endpoint.cs• L15-69, src/…/Endpoint.cs• L13-63
The permission catalog is the shared contract between the server and role-management clients. An authenticated caller can request its own effective grants for UI state. A role editor with role-view permission can request the installed resource catalog and inspect the current reach of a wildcard grant. These responses help clients render safe controls, but each protected endpoint makes its own authorization decision. src/…/Endpoint.cs• L8-37, src/…/Endpoint.cs• L9-32, src/…/Endpoint.cs• L10-51, src/…/Models.cs• L3-16
Role deletion can report dependencies and can remove a role from supported editable policies before deletion. The operation is kept under the same role-delete permission and uses an expected dependency version so a stale remediation request does not silently change security policy. src/…/Endpoint.cs• L8-27, src/…/GetDeletionImpact.cs• L8-21, src/…/RemediateAndDelete.cs• L10-40
References: src/…/IdentityPermissions.cs• L7-31 src/…/TenantPermissions.cs• L7-25 src/…/SecretsResourcePermissions.cs• L7-25 src/…/RoleAuthorizationService.cs• L10-66 src/…/Endpoint.cs• L15-69 src/…/Endpoint.cs• L8-37 src/…/Endpoint.cs• L9-32 src/…/Endpoint.cs• L10-51 src/…/RemediateAndDelete.cs• L10-40
Permission freshness
Issued identity tokens include the roles and permissions known at issue time. Hosts can enable a permission stamp to compare that claim with the user's current role grants on later requests, which shortens the time that a removed grant remains effective. The stamp is tenant-scoped and cached per node, so the cache lifetime becomes the practical revocation bound when this option is enabled. src/…/PermissionStampCalculator.cs• L10-47, src/…/PermissionStampValidator.cs• L12-57, src/…/PermissionStampOptions.cs• L3-18, src/…/DefaultAccessTokenIssuer.cs• L41-57
The system also checks stored role grants at startup against the current permission catalog. It reports grants that no longer resolve, while leaving startup available so an operator can repair the roles. src/…/StoredPermissionValidator.cs• L11-64
Role and assignment changes publish redacted notifications with the actor, tenant, time, and resulting grants. Identity does not store the audit record; another module can subscribe and apply its own storage and retention policy. src/…/RoleSecurityNotifications.cs• L5-37, src/…/RoleSecurityNotifier.cs• L10-32
References: src/…/PermissionStampCalculator.cs• L10-47 src/…/PermissionStampValidator.cs• L12-57 src/…/PermissionStampOptions.cs• L3-18 src/…/StoredPermissionValidator.cs• L11-64 src/…/RoleSecurityNotifications.cs• L5-37 src/…/RoleSecurityNotifier.cs• L10-32
Identity tenant selection
Identity can help select the tenant after authentication. One resolver reads the tenant claim from the current principal. Another finds the current user and reads the tenant assigned to that user. This creates a link between identity proof and tenant data access, but the resolved tenant must still exist in the tenant source used by the pipeline. src/…/ClaimsTenantResolver.cs• L8-23, src/…/CurrentUserTenantResolver.cs• L8-35, src/…/DefaultTenantResolverPipelineInvoker.cs• L17-40
The tenant claim type is configurable. Token issuance, refresh handling, and claim-based resolution must use the same setting or an authenticated request may not resolve the tenant that the token represents. src/…/CustomClaimTypes.cs• L7-16, src/…/IdentityTokenOptions.cs• L43-47, src/…/DefaultElsaTokenService.cs• L64-75, src/…/DefaultIdentityRefreshTokenService.cs• L45-57
References: src/…/ClaimsTenantResolver.cs• L8-23 src/…/CurrentUserTenantResolver.cs• L8-35 src/…/CustomClaimTypes.cs• L7-16 src/…/IdentityTokenOptions.cs• L43-47 src/…/DefaultElsaTokenService.cs• L64-75 src/…/DefaultIdentityRefreshTokenService.cs• L45-57 src/…/DefaultTenantResolverPipelineInvoker.cs• L17-40
Secret storage and use
The secrets service gives workflows and API clients a named reference to a sensitive value without placing that value in workflow definitions or expressions. It separates secret metadata from the store that reads or writes the value, which lets a host use Elsa-managed protection or an external configuration source.
Secret lifecycle
A secret has a stable name, a type, a store, an optional scope, tags, and one or more versions. Only the latest active and non-expired version can resolve. Rotation retires the prior active version and creates a new one; revocation makes the secret and its active versions unusable; deletion removes the stored value when the store supports deletion and hides the secret from normal reads. src/…/Secret.cs• L5-37, src/…/SecretVersion.cs• L3-12, src/…/DefaultSecretManager.cs• L62-115
Secret names are normalized and references can require a type or scope. The resolver checks those constraints before it reads the active payload, so a workflow can state what kind of secret it expects without knowing how the value is stored. src/…/SecretReference.cs• L1-3, src/…/DefaultSecretResolver.cs• L3-21
Lifecycle-managed generations are internal secret records owned by a specific credential or other resource. Normal lists, generic name-based management, and the HTTP detail endpoint hide these records. Owner-scoped generation operations remain the only path that can resolve or clean them up. src/…/DefaultSecretManager.cs• L148-215, src/…/Endpoint.cs• L16-27
Secret records are protected by the secrets resource. View, write, delete, and test are separate actions. Write covers creation, metadata changes, rotation, and revocation; viewing a secret record does not itself grant a client a separate JavaScript or workflow-value permission. The secret picker uses view permission and reports inline creation only when the caller has write permission and at least one writable store is available. src/…/SecretsResourcePermissions.cs• L7-25, src/…/Endpoint.cs• L8-25, src/…/Endpoint.cs• L10-39, src/…/Endpoint.cs• L8-30, src/…/Endpoint.cs• L7-17
References: src/…/Secret.cs• L5-37 src/…/SecretVersion.cs• L3-12 src/…/DefaultSecretManager.cs• L62-115 src/…/DefaultSecretManager.cs• L148-215 src/…/SecretReference.cs• L1-3 src/…/DefaultSecretResolver.cs• L3-21 src/…/SecretsResourcePermissions.cs• L7-25 src/…/Endpoint.cs• L8-27 src/…/Endpoint.cs• L10-39 src/…/Endpoint.cs• L8-30
Secret stores
A secret store owns the value operation for one storage method. The encrypted store protects values before it persists them and supports read, write, delete, test, and versioned behavior. The configuration store keeps only a configuration key in Elsa and reads the current value from application configuration, so its value is not stored in Elsa and cannot be deleted through Elsa. src/…/ISecretStore.cs• L1-11, src/…/EncryptedSecretStore.cs• L3-51, src/…/ConfigurationSecretStore.cs• L6-43
Store capabilities describe which lifecycle actions are safe for a store. The manager checks these capabilities before it creates or rotates a secret, while a store can still report whether its current value is readable. src/…/SecretStoreCapabilities.cs• L1-13, src/…/DefaultSecretManager.cs• L166-220
References: src/…/ISecretStore.cs• L1-11 src/…/EncryptedSecretStore.cs• L3-51 src/…/ConfigurationSecretStore.cs• L6-43 src/…/SecretStoreCapabilities.cs• L1-13 src/…/DefaultSecretManager.cs• L166-220
Workflow secret expressions
Workflow expressions store a SecretReference rather than a secret value. At evaluation time, the expression handler resolves the reference and converts the result to the expected type. This keeps the workflow model portable while delaying access to the protected value until execution. src/…/SecretExpression.cs• L5-18, src/…/SecretExpressionHandler.cs• L7-23
References: src/…/SecretExpression.cs• L5-18 src/…/SecretExpressionHandler.cs• L7-23
JavaScript secret access
The JavaScript integration exposes getSecret(name) while a script is evaluated. The function calls the same secret resolver as workflow expressions and uses the script cancellation token, so JavaScript does not create a separate secret access path or storage rule. src/…/SecretsJavaScriptHandler.cs• L10-25
The function returns the resolved secret string. It can fail when the named secret is missing, has the wrong type or scope, has no usable active version, or is a lifecycle-managed generation. The surrounding workflow and endpoint security context remains responsible for deciding who may run the script. src/…/SecretsJavaScriptHandler.cs• L11-17, src/…/DefaultSecretResolver.cs• L7-20, src/…/DefaultSecretManager.cs• L148-163
References: src/…/SecretsJavaScriptHandler.cs• L10-25 src/…/DefaultSecretResolver.cs• L7-20 src/…/DefaultSecretManager.cs• L148-163
SAS token capabilities
A SAS token is a protected, signed data link that grants access to a narrowly described action without requiring a normal authenticated session. Elsa uses its token service to carry a workflow event or bookmark identity and can make the link expire or remain non-expiring.
Token protection
The SAS token service serializes a payload and protects it with ASP.NET Core Data Protection. It supports a lifetime, a fixed expiration time, or no expiration, and it offers strict decryption or a safe try form that returns failure for an invalid token. src/…/ITokenService.cs• L3-31, src/…/DataProtectorTokenService.cs• L7-101
The SAS feature sets the shared Data Protection application name and registers the token service. Hosts can replace the service when they need a different protection boundary, but token creators and consumers must continue to use compatible protection settings. src/…/SasTokensFeature.cs• L9-34
References: src/…/ITokenService.cs• L3-31 src/…/DataProtectorTokenService.cs• L7-101 src/…/SasTokensFeature.cs• L9-34
Public workflow links
Workflow execution can create a SAS URL for two public actions:
- An event URL carries an event name and workflow instance ID. The public endpoint validates the token and publishes that event to the instance.
- A bookmark URL carries a bookmark ID and workflow instance ID. The public endpoint validates the token and resumes the bookmark, either now or through the bookmark queue.
These endpoints are intentionally anonymous because possession of the protected token is the access proof. The token lifetime and payload scope must therefore match the intended exposure. src/…/EventExpressionExecutionContextExtensions.cs• L16-73, src/…/BookmarkExecutionContextExtensions.cs• L25-82, src/…/Endpoint.cs• L8-49, src/…/Endpoint.cs• L13-58
The relationship between token creation and use is:
sequenceDiagram
participant Workflow as Workflow execution
participant Tokens as SAS token service
participant Caller as External caller
participant API as Public workflow endpoint
participant Runtime as Workflow runtime
Workflow->>Tokens: Protect event or bookmark payload
Tokens-->>Workflow: SAS URL
Caller->>API: Request with token
API->>Tokens: Validate and decrypt token
Tokens-->>API: Workflow action payload
API->>Runtime: Publish event or resume bookmark
References: src/…/EventExpressionExecutionContextExtensions.cs• L16-73 src/…/BookmarkExecutionContextExtensions.cs• L25-82 src/…/Endpoint.cs• L8-49 src/…/Endpoint.cs• L13-58
Change checklist
When these files or sections are changed, remember to consider these:
- Keep every tenant resolver aligned with the tenant provider. A resolver can identify only tenants that the pipeline loads.
- Preserve the tenant ID on identity records and keep tenant-agnostic role behavior aligned with tenant query filters.
- Keep role IDs globally unique while allowing role names to repeat across tenants. Keep name lookup biased toward the current tenant's role.
- Keep user IDs globally unique when refresh lookup uses the token subject without a tenant filter.
- Keep the tenant claim name aligned across token issuance, JWT validation, refresh handling, and claim-based tenant resolution.
- Keep refresh-token session claims aligned across token issuance, refresh continuation, logout, and revoked-session lookup.
- Keep revoked-session storage tenant-agnostic and shared when refresh authentication runs before tenant resolution.
- When changing role endpoints or permission descriptors, preserve catalog validation, endpoint access, grant validation, and permission containment as separate checks.
- Keep permission catalog and effective-grant responses aligned with the resources and verbs that endpoints enforce.
- When enabling permission stamps, keep the stamp calculation, token claim, tenant-scoped cache key, and validation lifetime aligned.
- Keep secret store capabilities aligned with manager lifecycle actions and keep value-read behavior aligned with
ISecretResolver. - Keep lifecycle-managed generation ownership aligned across generation access, generic secret endpoints, and list or picker results.
- Keep secret record permissions separate from the script and workflow execution context that calls
ISecretResolver. - Keep SAS payload producers and anonymous consumers compatible on payload shape, protection keys, and token lifetime semantics.
- Preserve the route-prefix path adjustment when changing HTTP tenant routing or tenant-specific endpoint URL generation.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A resolver returns an ID that is not in the active tenant source | The request has no tenant scope and the pipeline returns no tenant | Load the tenant in the configured provider before using the resolver |
| Token issuance and claim resolution use different tenant claim types | Authenticated requests can use a valid token but resolve the wrong or no tenant | Keep TenantIdClaimsType shared across both paths |
| A role name is resolved without the ambient tenant or a shared role wins over a tenant-owned role | A user or bootstrap task can use the wrong tenant's role or change a shared role | Apply the tenant filter and use the tenant-aware name lookup |
| A role ID is derived from a name or reused across tenants | A role create or bootstrap operation collides with another role in a shared store | Generate globally unique role IDs and treat names as tenant-scoped |
| A caller tries to assign or create a role with a grant it does not hold | The role change is rejected instead of allowing privilege escalation | Validate the grant and use permission containment before saving the role |
| A stored role grant no longer resolves in the permission catalog | That grant does not authorize and the startup validator reports the affected role | Re-author the role against the current permission catalog |
| A removed role grant remains in an access token | The caller keeps the old permission until token expiry or the configured stamp cache expires | Enable permission stamps when the token lifetime is not a suitable revocation bound |
| Logout uses a refresh token from another user or tenant | The session is not revoked | Require the refresh token subject and tenant claim to match the authenticated caller |
| A refresh token omits a stable or agreeing subject | Refresh cannot identify the user and returns unauthorized | Issue a stable user ID and reject ambiguous subject claims |
| A revoked-session store is in memory in a restarted or multi-node host | A logged-out session can refresh on another node or after restart | Use a durable shared IRevokedSessionStore for the required revocation scope |
| No user exists and neither bootstrap path is configured | Management requests remain unusable because no identity can receive permissions | Configure a seeded administrator or an explicit admin API key |
| A secret has no active, non-expired version | Secret expressions, JavaScript, and direct secret use fail | Rotate or restore a valid version before execution |
| A configuration secret points to a missing configuration key | Secret testing and resolution report no value | Keep the external configuration key present in the host |
| A lifecycle-managed generation is accessed through a generic secret or JavaScript path | The generation is hidden or rejected instead of exposing a credential outside its owner | Use the owner-scoped generation contract for managed credentials |
| A SAS token is expired, malformed, or protected with incompatible keys | The public event or bookmark action is rejected | Use compatible Data Protection settings and a suitable token lifetime |
Key files
| File | Why to read it |
|---|---|
| src/…/DefaultTenantResolverPipelineInvoker.cs | Shows how known tenants and resolver strategies produce the current tenant. |
| src/…/TenantResolutionMiddleware.cs | Shows where HTTP tenant selection becomes request scope and path context. |
| src/…/TenantPermissions.cs | Shows the tenant-management resource and its protected actions. |
| src/…/DefaultAuthenticationFeature.cs | Shows the built-in JWT and API key authentication boundary. |
| src/…/DefaultElsaTokenService.cs | Shows the identity, role, permission, tenant, and sign-in session claims carried by tokens. |
| src/…/DefaultIdentityRefreshTokenService.cs | Shows how a refresh token restores tenant context and continues a sign-in session. |
| src/…/Endpoint.cs | Shows how logout verifies ownership and revokes the refresh-token session. |
| src/…/SessionRevoker.cs | Shows the session-wide refresh-token revocation boundary. |
| src/…/RoleManager.cs | Shows the tenant-scoped role-name and globally unique role-ID contract. |
| src/…/RoleStoreExtensions.cs | Shows how role names are resolved when tenant-owned and tenant-agnostic roles are both visible. |
| src/…/AdminUserInitializer.cs | Shows how each activated tenant receives the configured bootstrap role and optional user. |
| src/…/Endpoint.cs | Shows permission validation and anti-escalation checks for role creation. |
| src/…/RoleAuthorizationService.cs | Shows how role permissions are checked before security changes. |
| src/…/Endpoint.cs | Shows the permission catalog used by role-management clients. |
| src/…/PermissionStampValidator.cs | Shows the optional check that shortens permission revocation time. |
| src/…/DefaultSecretManager.cs | Shows the secret lifecycle, managed-generation boundary, and hand-off to a selected store. |
| src/…/Endpoint.cs | Shows why lifecycle-managed generations do not appear through the normal secret detail endpoint. |
| src/…/Endpoint.cs | Shows how the picker filters available secrets and reports whether inline creation is allowed. |
| src/…/DefaultSecretResolver.cs | Shows how references become usable secret values. |
| src/…/EncryptedSecretStore.cs | Shows the Elsa-managed protected-value store. |
| src/…/SecretsJavaScriptHandler.cs | Shows the single JavaScript entry point for secret values. |
| src/…/DataProtectorTokenService.cs | Shows the protection and lifetime contract for SAS payloads. |
| src/…/Endpoint.cs | Shows how a valid event SAS token reaches the workflow runtime. |
| src/…/Endpoint.cs | Shows how a valid bookmark SAS token resumes workflow work. |