< Summary - Kestrun — Combined Coverage

Information
Class: Public.JWT.Test-KrJWT
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/JWT/Test-KrJWT.ps1
Tag: Kestrun/Kestrun@2d87023b37eb91155071c91dd3d6a2eeb3004705
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 41
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: 0% (0/3) Total lines: 40 Tag: Kestrun/Kestrun@07f821172e5dc3657f1be7e6818f18d6721cf38a09/04/2025 - 22:37:32 Line coverage: 0% (0/3) Total lines: 41 Tag: Kestrun/Kestrun@afb7aadc0a8a42bfa2b51ea62c8a6e2cf63faec6

Metrics

Method
Test-KrJWT()

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/JWT/Test-KrJWT.ps1

#LineLine coverage
 1<#
 2    .SYNOPSIS
 3        Validates a JWT token against the builder's parameters.
 4    .DESCRIPTION
 5        This function validates a JWT token against the parameters set in the JWT builder, checking for expiration, issu
 6    .PARAMETER Result
 7        The JWT builder result containing the token and validation parameters.
 8    .PARAMETER Token
 9        The JWT token to validate.
 10    .PARAMETER ClockSkew
 11        The allowed clock skew for validation, defaulting to 1 minute.
 12    .OUTPUTS
 13        [bool]
 14        Returns true if the token is valid, otherwise false.
 15    .EXAMPLE
 16        $isValid = New-KrJWTTokenBuilder | Add-KrJWTSubject -Subject "mySubject" | Build-KrJWT | Test-KrJWT -Token $toke
 17        This example creates a new JWT token builder, adds a subject, and then tests the validity of the JWT token.
 18    .NOTES
 19        This function is part of the Kestrun.Jwt module and is used to validate JWT tokens.
 20        Maps to JwtBuilderResult.Validate
 21    .LINK
 22        https://docs.microsoft.com/en-us/dotnet/api/system.identitymodel.tokens.jwt.jwtsecuritytoken
 23#>
 24function Test-KrJWT {
 25    [KestrunRuntimeApi('Everywhere')]
 26    [CmdletBinding()]
 27    [OutputType([bool])]
 28    param(
 29        [Parameter(Mandatory = $true, ValueFromPipeline)]
 30        [Kestrun.Jwt.JwtBuilderResult] $Result,
 31        [Parameter(Mandatory)]
 32        [string] $Token,
 33        [Parameter()]
 034        [TimeSpan] $ClockSkew = ([TimeSpan]::FromMinutes(1))
 35    )
 36    process {
 037        $validationResult = $Result.Validate($Token, $ClockSkew)
 038        return $validationResult.IsValid
 39    }
 40}
 41

Methods/Properties

Test-KrJWT()