Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for missing merged auth docs, and add a quicker default selector for merging All auths #1277

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

Badgerati
Copy link
Owner

Description of the Change

Adds documentation which was missing, describing the need for -ScriptBlock on Merge-PodeAuth when -Valid All was passed.

Also adds a quick new -MergeDefault when -Valid All is passed, which acts as a faster shorthand for -ScriptBlock when we only want to use the User object returned by just one of the authentication methods.

Also fixes some of the merged auth examples, still using an older format.

Related Issue

Resolves #1179

Examples

Merge-PodeAuth -Name 'MergedAuth' -Authentication 'ApiKey', 'Basic' -Valid All -ScriptBlock {
    param($results)

    $apiUser = $results['ApiKey'].User
    $basicUser = $results['Basic'].User

    return @{
        User = @{
            Username = $basicUser.Username
            ID       = $apiUser.ID
            Name     = $apiUser.Name
            Type     = $apiUser.Type
            Roles    = @($apiUser.Roles + $basicUser.Roles) | Sort-Object -Unique
            Groups   = @($apiUser.Groups + $basicUser.Groups) | Sort-Object -Unique
        }
    }
}

@Badgerati Badgerati added this to the 2.10.0 milestone Apr 3, 2024
@Badgerati Badgerati self-assigned this Apr 3, 2024
@Badgerati Badgerati merged commit 9807b41 into develop Apr 3, 2024
30 checks passed
@Badgerati Badgerati deleted the Issue-1179 branch April 3, 2024 14:58
@Badgerati Badgerati mentioned this pull request Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The scriptblock part of the merged Authentication documentation has vanished
1 participant