| | | 1 | | <# |
| | | 2 | | .SYNOPSIS |
| | | 3 | | Creates a new cloned JWT token builder instance. |
| | | 4 | | .DESCRIPTION |
| | | 5 | | This function creates a new cloned instance of the JwtTokenBuilder class, which is used to construct JWT tokens. |
| | | 6 | | .PARAMETER Builder |
| | | 7 | | The original JWT token builder instance to clone. |
| | | 8 | | .EXAMPLE |
| | | 9 | | # Creates a new cloned JWT token builder instance |
| | | 10 | | $builder = $oldBuilder|New-KrJWTToken |
| | | 11 | | |
| | | 12 | | .EXAMPLE |
| | | 13 | | # Creates a new cloned JWT token builder instance |
| | | 14 | | $builder = New-KrJWTToken -Builder $oldBuilder |
| | | 15 | | |
| | | 16 | | $builder.WithSubject('admin') |
| | | 17 | | .WithIssuer('https://issuer') |
| | | 18 | | .WithAudience('api') |
| | | 19 | | .SignWithSecret('uZ6zDP3CGK3rktmVOXQk8A') # base64url |
| | | 20 | | .EncryptWithCertificate($cert,'RSA-OAEP','A256GCM') |
| | | 21 | | .Build() |
| | | 22 | | |
| | | 23 | | .OUTPUTS |
| | | 24 | | [Kestrun.Jwt.JwtTokenBuilder] |
| | | 25 | | A new cloned instance of the JwtTokenBuilder class. |
| | | 26 | | .NOTES |
| | | 27 | | This function is part of the Kestrun.Jwt module and is used to build JWT tokens. |
| | | 28 | | Maps to JwtTokenBuilder.New |
| | | 29 | | #> |
| | | 30 | | function Copy-KrJWTTokenBuilder { |
| | | 31 | | [KestrunRuntimeApi('Everywhere')] |
| | | 32 | | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] |
| | | 33 | | [CmdletBinding()] |
| | | 34 | | [OutputType([Kestrun.Jwt.JwtTokenBuilder])] |
| | | 35 | | param( |
| | | 36 | | [Parameter(Mandatory = $true, ValueFromPipeline)] |
| | | 37 | | [Kestrun.Jwt.JwtTokenBuilder] $Builder |
| | | 38 | | ) |
| | | 39 | | process { |
| | | 40 | | # Create a new JWT token builder instance |
| | 0 | 41 | | return $Builder.CloneBuilder() |
| | | 42 | | } |
| | | 43 | | } |
| | | 44 | | |