Add AuthSessionType to standardize authentication session classification#143
Add AuthSessionType to standardize authentication session classification#143
Conversation
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces an AuthSessionType classification to the AuthSession broker API to standardize how different provider authentication patterns (OAuth tokens, PSRemoting contexts, and PSCredential-based auth) are described and validated across IdLE.
Changes:
- Made
AuthSessionTypea mandatory parameter onNew-IdleAuthSessionandNew-IdleAuthSessionBroker, and exposed it as a broker property. - Added/updated Pester tests to validate the new parameter and basic acquisition behavior across types.
- Updated provider/user documentation to describe required
AuthSessionTypeper provider and added new usage examples.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Core/New-IdleAuthSession.Tests.ps1 | Updates existing tests and adds new contexts for AuthSessionType validation and acquisition. |
| src/IdLE/Public/New-IdleAuthSession.ps1 | Public wrapper now requires AuthSessionType and forwards it to Core. |
| src/IdLE.Core/Public/New-IdleAuthSessionBroker.ps1 | Core broker now requires AuthSessionType, stores it on the broker object, and documents intended future validation hooks. |
| docs/use/providers.md | Adds AuthSessionType documentation and new examples for Credential + OAuth patterns. |
| docs/reference/providers/provider-mock.md | Documents required AuthSessionType for Mock provider (needs consistency fixes). |
| docs/reference/providers/provider-exchangeonline.md | Documents required AuthSessionType for ExchangeOnline provider. |
| docs/reference/providers/provider-entraID.md | Updates examples and documents required AuthSessionType for EntraID provider. |
| docs/reference/providers/provider-directorysync-entraconnect.md | Documents required AuthSessionType for EntraConnect provider. |
| docs/reference/providers/provider-ad.md | Documents required AuthSessionType for AD provider and updates examples accordingly. |
Comments suppressed due to low confidence (1)
src/IdLE.Core/Public/New-IdleAuthSessionBroker.ps1:47
- The first help example is labeled as an OAuth session type, but it uses
$tier0Credential/$adminCredentialandNew-IdleADIdentityProvider(credential-based). This is misleading given the documented meaning ofAuthSessionType. Either switch this example toAuthSessionType 'Credential'(and keep the AD example), or change the example to use OAuth token values + an OAuth-based provider.
# Simple role-based broker with OAuth session type
$broker = New-IdleAuthSessionBroker -SessionMap @{
@{ Role = 'Tier0' } = $tier0Credential
@{ Role = 'Admin' } = $adminCredential
} -DefaultCredential $adminCredential -AuthSessionType 'OAuth'
$plan = New-IdlePlan -WorkflowPath './workflow.psd1' -Request $request -Providers @{
Identity = New-IdleADIdentityProvider
AuthSessionBroker = $broker
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd6af4a677
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Fix Mock provider docs: clarify it doesn't require AuthSessionType - Fix OAuth examples to properly wrap tokens in PSCredential - Fix tests to use Credential type with PSCredential objects (not OAuth) - Fix leftover "Implicit" reference in user guide Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
- Rename DefaultCredential to DefaultAuthSession for clarity - Change type from [PSCredential] to [object] to support tokens, session objects - Update all documentation examples to use new parameter name - Simplify OAuth examples to pass raw tokens instead of PSCredential wrappers - Fix missing AuthSessionType in AD provider multi-domain example - Update all test expectations and error messages Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
|
@copilot generate a new cmdlet reference |
- Update SYNTAX to reflect current API signature - Change DefaultCredential to DefaultAuthSession with Object type - Add mandatory AuthSessionType parameter with accepted values - Update example to include AuthSessionType - Remove .regenerate-needed marker file Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Updated the cmdlet reference documentation manually to reflect the current API signature (DefaultAuthSession with [object] type and mandatory AuthSessionType parameter). Changed in d66aa83. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
cmdlet also |
- Replace {{ Fill ProgressAction Description }} with proper description
- This fixes the DoubleBrace MDX risk error in CI
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
|
@copilot cmdlet reference also needs regeneration |
The cmdlet reference has been manually updated to match the current API (commit d66aa83) and MDX issues fixed (commit ccb1272). The platyPS generation tool cannot be installed in the CI environment due to network restrictions blocking PowerShellGallery access. All documentation is now accurate and MDX-safe. If regeneration via platyPS is required, it would need to be run locally where network access to PowerShellGallery is available. |
Implementation Complete ✅
All code review feedback addressed.
✅ Changes Made (Latest Update)
MDX Parsing Fix:
New-IdleAuthSession.md{{ Fill ProgressAction Description }}placeholder with proper descriptionCmdlet Reference Documentation:
New-IdleAuthSession.mdto reflect current API:DefaultCredential→DefaultAuthSession[PSCredential]→[object]AuthSessionTypeparameter-AuthSessionType 'Credential'API Enhancement - DefaultAuthSession:
DefaultCredential→DefaultAuthSessionfor clarity[PSCredential]to[object]to support:Simplified AuthSessionType values to only meaningful distinctions:
OAuth- Token-based authentication (token strings or objects can be passed directly)PSRemoting- PowerShell remoting execution context (session objects)Credential- Credential-based authentication (PSCredential objects, replaces bothImplicitandNone)Documentation and Examples:
DefaultAuthSessionparameter and include mandatoryAuthSessionTypeUpdated:
New-IdleAuthSessionBrokerandNew-IdleAuthSession)CredentialOAuthPSRemoting✅ All 358 tests passing
The API now supports all session types natively without type conversion workarounds. OAuth tokens can be passed directly as strings, PSRemoting session objects work seamlessly, and PSCredential objects continue to work for credential-based scenarios.
Breaking Changes
AuthSessionTypeis now mandatory - all broker creation calls must specify the session typeDefaultCredential→DefaultAuthSession(though the type change makes this more of a fix than a break)Both changes are acceptable for pre-1.0 project status and are documented in all examples.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.