< Summary - Kestrun — Combined Coverage

Information
Class: Public.Authentication.Add-KrWindowsAuthentication
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Authentication/Add-KrWindowsAuthentication.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 4
Coverable lines: 4
Total lines: 44
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 08/26/2025 - 01:25:22 Line coverage: 75% (3/4) Total lines: 43 Tag: Kestrun/Kestrun@07f821172e5dc3657f1be7e6818f18d6721cf38a09/04/2025 - 22:37:32 Line coverage: 75% (3/4) Total lines: 44 Tag: Kestrun/Kestrun@afb7aadc0a8a42bfa2b51ea62c8a6e2cf63faec609/08/2025 - 20:34:03 Line coverage: 66.6% (4/6) Total lines: 48 Tag: Kestrun/Kestrun@3790ee5884494a7a2a829344a47743e0bf492e7210/13/2025 - 16:52:37 Line coverage: 0% (0/4) Total lines: 44 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e

Metrics

File(s)

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

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Adds Windows authentication to the Kestrun server.
 4    .DESCRIPTION
 5        Configures the Kestrun server to use Windows authentication for incoming requests.
 6        This allows the server to authenticate users based on their Windows credentials.
 7        This enables the server to use Kerberos or NTLM for authentication.
 8    .PARAMETER Server
 9        The Kestrun server instance to configure.
 10    .PARAMETER PassThru
 11        If specified, returns the modified server instance after adding the authentication.
 12    .EXAMPLE
 13        Add-KrWindowsAuthentication -Server $myServer -PassThru
 14        This example adds Windows authentication to the specified Kestrun server instance and returns the modified insta
 15    .LINK
 16        https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.authentication.windowsauthentication?view=aspn
 17    .NOTES
 18        This cmdlet is used to configure Windows authentication for the Kestrun server, allowing you to secure your APIs
 19#>
 20function Add-KrWindowsAuthentication {
 21    [KestrunRuntimeApi('Definition')]
 22    [CmdletBinding(defaultParameterSetName = 'ItemsScriptBlock')]
 23    [OutputType([Kestrun.Hosting.KestrunHost])]
 24    param(
 25        [Parameter(Mandatory = $false, ValueFromPipeline)]
 26        [Kestrun.Hosting.KestrunHost]$Server,
 27
 28        [Parameter()]
 29        [switch]$PassThru
 30    )
 31    begin {
 32        # Ensure the server instance is resolved
 033        $Server = Resolve-KestrunServer -Server $Server
 34    }
 35    process {
 36        # Add Windows authentication to the server instance ---
 037        [Kestrun.Hosting.KestrunHostAuthnExtensions]::AddWindowsAuthentication($Server) | Out-Null
 038        if ($PassThru.IsPresent) {
 39            # if the PassThru switch is specified, return the modified server instance
 040            return $Server
 41        }
 42    }
 43}
 44

Methods/Properties

Add-KrWindowsAuthentication()