Context
IdLE keeps authentication out of the core engine and out of workflow/step configuration.
Hosts provide an AuthSessionBroker via Providers.AuthSessionBroker, and steps/providers can acquire sessions via
Context.AcquireAuthSession(Name, Options).
The Active Directory provider introduced in #46 still supports direct credential injection and includes examples
that can encourage interactive auth (e.g., Get-Credential). This deviates from the documented project guidance:
providers/steps must not run authentication flows themselves; authentication must be host-driven via the broker.
This issue aligns IdLE.Provider.AD (and the relevant built-in step contract usage) with the AuthSessionBroker model
so that real-world scenarios like multiple admin accounts per system (Tier0 vs. Admin) can be implemented without
secrets in plans/workflows.
Problem
Example real-world requirement:
- Step 1 must use a dedicated Tier0 AD admin account.
- Step 2 must use a separate admin account.
- Both accounts are different from the OS user running the host process.
Today, the AD provider can be configured with credentials at construction time, but the engine/steps do not provide a
standard, data-only way to select different auth contexts per step while keeping authentication centralized in the host.
Goals
- Route AD authentication/session selection via
Context.AcquireAuthSession(...) (AuthSessionBroker).
- Support multiple auth contexts (e.g., Tier0 vs. Admin) selectable per step using data-only metadata.
- Keep workflow definitions and step parameters data-only (no ScriptBlocks, no secrets).
- Remove interactive authentication from provider examples.
- Add/adjust tests to keep this behavior deterministic and mockable.
Non-goals
- No interactive authentication inside
IdLE.Core, steps, or providers.
- No requirement to implement MFA/DeviceCode for AD itself.
(The mechanism must be compatible with MFA/DeviceCode for other systems, but AD usage will typically remain
PSCredential/integrated auth behind the broker.)
- No live AD integration tests as part of unit/contract tests.
Proposed Design (recommended)
A) Step-level, data-only auth routing keys
Introduce optional With.* keys for steps that call providers:
With.AuthSessionName (string)
With.AuthSessionOptions (hashtable, data-only)
- Example:
@{ Role = 'Tier0' } or @{ Role = 'Admin' }
Notes:
With.AuthSessionOptions must remain data-only and must be validated the same way as other untrusted inputs
(ScriptBlocks rejected, including nested values).
- Options must not contain secrets. Secrets are managed by the host and are not allowed in plans/events/exports.
B) Acquire auth session at execution time
In step execution (for steps that call providers):
- If
With.AuthSessionName is present, acquire a session:
$authSession = $Context.AcquireAuthSession($With.AuthSessionName, $With.AuthSessionOptions)
- If not present,
$authSession = $null.
C) Pass AuthSession to provider calls when supported (backwards compatible)
Update the provider contract usage in the relevant step(s) so that provider methods can accept an optional session.
Pattern:
- If the provider method supports an
AuthSession (or Session) parameter, pass it.
- Otherwise, call the legacy signature.
This avoids breaking existing providers while enabling broker-driven authentication.
D) Update AD provider to consume AuthSession
- Update AD provider methods to accept an optional
AuthSession argument.
- The AD provider should interpret the session object in a documented way. Default expectation:
- session contains a
PSCredential (directly, or as a property like .Credential).
- The AD provider must not prompt or run its own login flow.
E) Deprecation path for -Credential on AD provider
- Keep
-Credential temporarily for backwards compatibility, but mark as deprecated (warning).
- Remove interactive examples (e.g.,
Get-Credential) and replace with broker-based examples.
- The recommended usage becomes: host implements broker and returns sessions based on
Name + Options.
Alternatives considered
Alternative 1: Two AD provider instances selected via With.Provider
- Create
AD_Tier0 and AD_Admin provider instances (each with embedded credentials) and select via With.Provider.
- Works today, but keeps credential handling in provider construction and does not standardize auth routing.
Alternative 2: Provider calls broker directly
- Provider would call
Context.AcquireAuthSession(...) itself.
- Requires passing
Context into provider calls or binding context into provider objects, which complicates the contract.
Recommendation remains: acquire session in steps (using Context) and pass session to providers when supported.
Acceptance Criteria (Definition of Done)
Work breakdown
- Update the relevant step(s) (likely
EnsureAttribute) to support With.AuthSessionName and With.AuthSessionOptions.
- Implement optional session passing to provider methods (parameter detection / fallback signature).
- Update AD provider to accept and use
AuthSession.
- Update examples to demonstrate Tier0/Admin scenario using broker options (no interactive prompts).
- Add tests (Pester) for routing, fallback, and ScriptBlock rejection.
- Update docs as needed (contracts + step metadata).
References
Context
IdLE keeps authentication out of the core engine and out of workflow/step configuration.
Hosts provide an AuthSessionBroker via
Providers.AuthSessionBroker, and steps/providers can acquire sessions viaContext.AcquireAuthSession(Name, Options).The Active Directory provider introduced in #46 still supports direct credential injection and includes examples
that can encourage interactive auth (e.g.,
Get-Credential). This deviates from the documented project guidance:providers/steps must not run authentication flows themselves; authentication must be host-driven via the broker.
This issue aligns
IdLE.Provider.AD(and the relevant built-in step contract usage) with the AuthSessionBroker modelso that real-world scenarios like multiple admin accounts per system (Tier0 vs. Admin) can be implemented without
secrets in plans/workflows.
Problem
Example real-world requirement:
Today, the AD provider can be configured with credentials at construction time, but the engine/steps do not provide a
standard, data-only way to select different auth contexts per step while keeping authentication centralized in the host.
Goals
Context.AcquireAuthSession(...)(AuthSessionBroker).Non-goals
IdLE.Core, steps, or providers.(The mechanism must be compatible with MFA/DeviceCode for other systems, but AD usage will typically remain
PSCredential/integrated auth behind the broker.)
Proposed Design (recommended)
A) Step-level, data-only auth routing keys
Introduce optional
With.*keys for steps that call providers:With.AuthSessionName(string)ActiveDirectoryWith.AuthSessionOptions(hashtable, data-only)@{ Role = 'Tier0' }or@{ Role = 'Admin' }Notes:
With.AuthSessionOptionsmust remain data-only and must be validated the same way as other untrusted inputs(ScriptBlocks rejected, including nested values).
B) Acquire auth session at execution time
In step execution (for steps that call providers):
With.AuthSessionNameis present, acquire a session:$authSession = $Context.AcquireAuthSession($With.AuthSessionName, $With.AuthSessionOptions)$authSession = $null.C) Pass
AuthSessionto provider calls when supported (backwards compatible)Update the provider contract usage in the relevant step(s) so that provider methods can accept an optional session.
Pattern:
AuthSession(orSession) parameter, pass it.This avoids breaking existing providers while enabling broker-driven authentication.
D) Update AD provider to consume
AuthSessionAuthSessionargument.PSCredential(directly, or as a property like.Credential).E) Deprecation path for
-Credentialon AD provider-Credentialtemporarily for backwards compatibility, but mark as deprecated (warning).Get-Credential) and replace with broker-based examples.Name+Options.Alternatives considered
Alternative 1: Two AD provider instances selected via
With.ProviderAD_Tier0andAD_Adminprovider instances (each with embedded credentials) and select viaWith.Provider.Alternative 2: Provider calls broker directly
Context.AcquireAuthSession(...)itself.Contextinto provider calls or binding context into provider objects, which complicates the contract.Recommendation remains: acquire session in steps (using
Context) and pass session to providers when supported.Acceptance Criteria (Definition of Done)
AuthSessioninput (documented expected shape).With.AuthSessionNameandWith.AuthSessionOptions.Context.AcquireAuthSession(...).the legacy signature.
With.AuthSessionOptionsare rejected (including nested values).Get-Credentialand do not show direct credential injection as the primary path.AuthSessionparameter still works (fallback call).Work breakdown
EnsureAttribute) to supportWith.AuthSessionNameandWith.AuthSessionOptions.AuthSession.References