| | 1 | | <# |
| | 2 | | .SYNOPSIS |
| | 3 | | Sets the NotBefore time for the JWT token builder. |
| | 4 | | .DESCRIPTION |
| | 5 | | This function sets the NotBefore time for the JWT token builder, specifying when the token becomes valid. |
| | 6 | | .PARAMETER Builder |
| | 7 | | The JWT token builder to modify. |
| | 8 | | .PARAMETER UtcBefore |
| | 9 | | The UTC time before which the JWT token is not valid. |
| | 10 | | .OUTPUTS |
| | 11 | | [Kestrun.Jwt.JwtTokenBuilder] |
| | 12 | | The modified JWT token builder. |
| | 13 | | .EXAMPLE |
| | 14 | | $builder = New-KrJWTTokenBuilder | Limit-KrJWTNotBefore -UtcBefore (Get-Date).AddMinutes(-5) |
| | 15 | | This example creates a new JWT token builder and sets its NotBefore time to 5 minutes in the past. |
| | 16 | | .NOTES |
| | 17 | | This function is part of the Kestrun.Jwt module and is used to build JWT tokens |
| | 18 | | Maps to JwtTokenBuilder.NotBefore |
| | 19 | | .LINK |
| | 20 | | https://docs.microsoft.com/en-us/dotnet/api/system.identitymodel.tokens.jwt.jwtsecuritytoken |
| | 21 | | #> |
| | 22 | | function Limit-KrJWTNotBefore { |
| | 23 | | [KestrunRuntimeApi('Everywhere')] |
| | 24 | | [CmdletBinding()] |
| | 25 | | [OutputType([Kestrun.Jwt.JwtTokenBuilder])] |
| | 26 | | param( |
| | 27 | | [Parameter(Mandatory = $true, ValueFromPipeline)] |
| | 28 | | [Kestrun.Jwt.JwtTokenBuilder] $Builder, |
| | 29 | | [Parameter(Mandatory)] |
| | 30 | | [DateTime] $UtcBefore |
| | 31 | | ) |
| | 32 | | process { |
| 0 | 33 | | return $Builder.NotBefore($UtcBefore) |
| | 34 | | } |
| | 35 | | } |
| | 36 | |
|