Generates a JSON Web Token (JWT)
New-Jwt.ps1 [[-Body] <IDictionary>] [[-Headers] <IDictionary>] [-Secret] <SecureString> [[-Algorithm] <String>]
[[-NotBefore] <DateTime>] [[-IssuedAt] <DateTime>] [-IncludeIssuedAt] [[-ExpirationTime] <DateTime>]
[[-ExpiresAfter] <TimeSpan>] [[-JwtId] <String>] [[-Issuer] <String>] [[-Subject] <String>]
[[-Audience] <String[]>] [[-Claims] <Hashtable>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
New-Jwt.ps1 -Subject 1234567890 -IssuedAt 2018-01-18T01:30:22Z -Secret (ConvertTo-SecureString swordfish -AsPlainText -Force)
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNTE2MjM5MDIyfQ.59noQVrGQKetFM3RRTe9m4MVBUMkLo3WxqqpPf1xJ-U
A hash of JWT body elements.
Type: IDictionary
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: @{}
Accept pipeline input: False
Accept wildcard characters: False
Custom headers (beyond typ and alg) to add to the JWT.
Type: IDictionary
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: @{}
Accept pipeline input: False
Accept wildcard characters: False
A secret used to sign the JWT.
Type: SecureString
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The hashing algorithm class to use when signing the JWT.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: HS256
Accept pipeline input: False
Accept wildcard characters: False
When the JWT becomes valid.
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies when the JWT was issued.
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Indicates the issued time should be included, based on the current datetime (ignored if IssuedAt is provided).
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
When the JWT expires.
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
How long from now until the JWT expires (ignored if ExpirationTime is provided).
Type: TimeSpan
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A unique (at least within a given issuer) identifier for the JWT.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A string or URI (if it contains a colon) indicating the entity that issued the JWT.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The principal (user) of the JWT as a string or URI (if it contains a colon).
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A string or URI (if it contains a colon), or a list of string or URIs that indicates who the JWT is intended for.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Additional claims to add to the body of the JWT.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 13
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
https://tools.ietf.org/html/rfc7519
https://docs.microsoft.com/dotnet/api/system.security.cryptography.hmac