| | | 1 | | <# |
| | | 2 | | .SYNOPSIS |
| | | 3 | | Builds the JWT token from the builder. |
| | | 4 | | .DESCRIPTION |
| | | 5 | | This function finalizes the JWT token construction by invoking the Build method on the JwtTokenBuilder instance. |
| | | 6 | | .PARAMETER Builder |
| | | 7 | | The JWT token builder to finalize. |
| | | 8 | | .OUTPUTS |
| | | 9 | | [Kestrun.Jwt.JwtBuilderResult] |
| | | 10 | | The constructed JWT token. |
| | | 11 | | .EXAMPLE |
| | | 12 | | $token = New-KrJWTTokenBuilder | Add-KrJWTSubject -Subject "mySubject" | |
| | | 13 | | Add-KrJWTIssuer -Issuer "myIssuer" | |
| | | 14 | | Add-KrJWTAudience -Audience "myAudience" | |
| | | 15 | | Build-KrJWT |
| | | 16 | | This example creates a new JWT token builder, adds a subject, issuer, and audience, and then builds the JWT toke |
| | | 17 | | .NOTES |
| | | 18 | | This function is part of the Kestrun.Jwt module and is used to build JWT tokens. |
| | | 19 | | Maps to JwtTokenBuilder.Build |
| | | 20 | | .LINK |
| | | 21 | | https://docs.microsoft.com/en-us/dotnet/api/system.identitymodel.tokens.jwt.jwtsecuritytoken |
| | | 22 | | #> |
| | | 23 | | function Build-KrJWT { |
| | | 24 | | [KestrunRuntimeApi('Everywhere')] |
| | | 25 | | [CmdletBinding()] |
| | | 26 | | [OutputType([Kestrun.Jwt.JwtBuilderResult])] |
| | | 27 | | param( |
| | | 28 | | [Parameter(Mandatory = $true, ValueFromPipeline)] |
| | | 29 | | [Kestrun.Jwt.JwtTokenBuilder] $Builder |
| | | 30 | | ) |
| | | 31 | | process { |
| | 0 | 32 | | return $Builder.Build() |
| | | 33 | | } |
| | | 34 | | } |
| | | 35 | | |