| | | 1 | | <# |
| | | 2 | | .SYNOPSIS |
| | | 3 | | Adds an audience to the JWT token builder. |
| | | 4 | | .LINK |
| | | 5 | | https://docs.microsoft.com/en-us/dotnet/api/system.identitymodel.tokens.jwt.jwtsecuritytoken |
| | | 6 | | .DESCRIPTION |
| | | 7 | | This function adds an audience to the JWT token builder, allowing for the specification of the token's audience. |
| | | 8 | | .PARAMETER Builder |
| | | 9 | | The JWT token builder to modify. |
| | | 10 | | .PARAMETER Audience |
| | | 11 | | The audience to set for the JWT token. |
| | | 12 | | .OUTPUTS |
| | | 13 | | [Kestrun.Jwt.JwtTokenBuilder] |
| | | 14 | | The modified JWT token builder. |
| | | 15 | | .EXAMPLE |
| | | 16 | | $builder = New-KrJWTTokenBuilder | Add-KrJWTAudience -Audience "myAudience" |
| | | 17 | | This example creates a new JWT token builder and adds an audience to it. |
| | | 18 | | .NOTES |
| | | 19 | | This function is part of the Kestrun.Jwt module and is used to build JWT tokens |
| | | 20 | | Maps to JwtTokenBuilder.WithAudience |
| | | 21 | | .LINK |
| | | 22 | | https://docs.microsoft.com/en-us/dotnet/api/system.identitymodel.tokens.jwt.jwtsecuritytoken |
| | | 23 | | #> |
| | | 24 | | function Add-KrJWTAudience { |
| | | 25 | | [KestrunRuntimeApi('Everywhere')] |
| | | 26 | | [CmdletBinding()] |
| | | 27 | | [OutputType([Kestrun.Jwt.JwtTokenBuilder])] |
| | | 28 | | param( |
| | | 29 | | [Parameter(Mandatory = $true, ValueFromPipeline)] |
| | | 30 | | [Kestrun.Jwt.JwtTokenBuilder] $Builder, |
| | | 31 | | [Parameter(Mandatory)] |
| | | 32 | | [string] $Audience |
| | | 33 | | ) |
| | | 34 | | process { |
| | 0 | 35 | | return $Builder.WithAudience($Audience) |
| | | 36 | | } |
| | | 37 | | } |
| | | 38 | | |