< Summary - Kestrun — Combined Coverage

Information
Class: Public.Authentication.Add-KrGitHubAuthentication
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Authentication/Add-KrGitHubAuthentication.ps1
Tag: Kestrun/Kestrun@ca54e35c77799b76774b3805b6f075cdbc0c5fbe
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 83
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 11/19/2025 - 02:25:56 Line coverage: 0% (0/4) Total lines: 55 Tag: Kestrun/Kestrun@98ff905e5605a920343154665980a71211a03c6d12/12/2025 - 17:27:19 Line coverage: 0% (0/4) Total lines: 77 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd12/21/2025 - 06:07:10 Line coverage: 0% (0/4) Total lines: 83 Tag: Kestrun/Kestrun@8cf7f77e55fd1fd046ea4e5413eb9ef96e49fe6a

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Authentication/Add-KrGitHubAuthentication.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Adds GitHub OAuth (Authorization Code) authentication to the Kestrun server.
 4.DESCRIPTION
 5    Convenience wrapper around the C# extension AddGitHubOAuthAuthentication. Registers three schemes:
 6      <Name>, <Name>.Cookies, <Name>.Policy
 7    Includes PKCE, saves tokens, maps login & avatar claims, and can enrich email from /user/emails.
 8.PARAMETER Server
 9    The Kestrun server instance. If omitted, uses the current active server.
 10.PARAMETER AuthenticationScheme
 11    Base scheme name (default 'GitHub').
 12.PARAMETER DisplayName
 13    Display name for the authentication scheme.
 14.PARAMETER Description
 15    A description of the GitHub authentication scheme.
 16.PARAMETER Deprecated
 17    If specified, marks the authentication scheme as deprecated in OpenAPI documentation.
 18.PARAMETER DocId
 19    Documentation IDs for the authentication scheme.
 20.PARAMETER ClientId
 21    GitHub OAuth App Client ID.
 22.PARAMETER ClientSecret
 23    GitHub OAuth App Client Secret.
 24.PARAMETER CallbackPath
 25    Optional callback path (default '/signin-oauth'). Must match your GitHub OAuth App redirect URL path.
 26.PARAMETER PassThru
 27    Return the modified server object.
 28.EXAMPLE
 29    Add-KrGitHubAuthentication -ClientId $env:GITHUB_CLIENT_ID -ClientSecret $env:GITHUB_CLIENT_SECRET
 30.EXAMPLE
 31    Add-KrGitHubAuthentication -AuthenticationScheme 'GitHubMain' -ClientId 'abc' -ClientSecret 'secret' -Scope 'gist' -
 32.NOTES
 33    Requires the generic OAuth2 infrastructure plus provider-specific handling in C#.
 34#>
 35function Add-KrGitHubAuthentication {
 36    [KestrunRuntimeApi('Definition')]
 37    [CmdletBinding()]
 38    [OutputType([Kestrun.Hosting.KestrunHost])]
 39    param(
 40        [Parameter(ValueFromPipeline = $true)]
 41        [Kestrun.Hosting.KestrunHost]$Server,
 42
 43        [Parameter()]
 44        [string]$AuthenticationScheme = [Kestrun.Authentication.AuthenticationDefaults]::GitHubAuthenticationSchemeName,
 45
 46        [Parameter()]
 47        [string]$DisplayName = [Kestrun.Authentication.AuthenticationDefaults]::GitHubDisplayName,
 48
 49        [Parameter()]
 50        [string[]]$DocId = [Kestrun.OpenApi.OpenApiDocDescriptor]::DefaultDocumentationIds,
 51
 52        [Parameter()]
 53        [string]$Description,
 54
 55        [Parameter()]
 56        [switch] $Deprecated,
 57
 58        [Parameter(Mandatory = $true)]
 59        [string]$ClientId,
 60        [Parameter(Mandatory = $true)]
 61        [string]$ClientSecret,
 62        [string]$CallbackPath = '/signin-oauth',
 63        [switch]$PassThru
 64    )
 65    begin {
 066        $Server = Resolve-KestrunServer -Server $Server
 67    }
 68    process {
 069        [Kestrun.Hosting.KestrunHostAuthnExtensions]::AddGitHubOAuthAuthentication(
 70            $Server,
 71            $AuthenticationScheme,
 72            $DisplayName,
 73            $DocId,
 74            $Description,
 75            $Deprecated.IsPresent,
 76            $ClientId,
 77            $ClientSecret,
 78            $CallbackPath
 079        ) | Out-Null
 80
 081        if ($PassThru) { return $Server }
 82    }
 83}

Methods/Properties

Add-KrGitHubAuthentication()