ConvertFrom PodeJwt - mdaneri/Pode GitHub Wiki
Converts a JWT token into a PowerShell object, optionally verifying its signature.
ConvertFrom-PodeJwt [-IgnoreSignature] [-Outputs <String>] [-HumanReadable]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertFrom-PodeJwt [-Token <String>] [-Outputs <String>] [-HumanReadable] -Authentication <String>
[-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertFrom-PodeJwt -Token <String> [-IgnoreSignature] [-Outputs <String>] [-HumanReadable]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertFrom-PodeJwt -Token <String> [-Outputs <String>] [-HumanReadable] -Certificate <String>
[-PrivateKeyPath <String>] [-CertificatePassword <SecureString>] [-RsaPaddingScheme <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertFrom-PodeJwt -Token <String> [-Outputs <String>] [-HumanReadable] -X509Certificate <X509Certificate2>
[-RsaPaddingScheme <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertFrom-PodeJwt -Token <String> [-Outputs <String>] [-HumanReadable] -CertificateThumbprint <String>
[-CertificateStoreName <StoreName>] [-CertificateStoreLocation <StoreLocation>] [-RsaPaddingScheme <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertFrom-PodeJwt -Token <String> [-Outputs <String>] [-HumanReadable] -CertificateName <String>
[-CertificateStoreName <StoreName>] [-CertificateStoreLocation <StoreLocation>] [-RsaPaddingScheme <String>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
ConvertFrom-PodeJwt -Token <String> [-Outputs <String>] [-HumanReadable] -Secret <Object>
[-ProgressAction <ActionPreference>] [<CommonParameters>]
The ConvertFrom-PodeJwt function takes a JWT token and decodes its header, payload, and signature. By default, it verifies the signature using a specified secret, certificate, or Pode authentication method. If IgnoreSignature is specified, the function decodes and returns the token payload without verification.
ConvertFrom-PodeJwt -Token $jwtToken -Secret 'mysecret'
Decodes and verifies the JWT token using an HMAC secret.
ConvertFrom-PodeJwt -Token $jwtToken -Certificate './certs/myCert.pem'
Decodes and verifies the JWT token using an X.509 certificate from a file.
A Pode authentication method name whose configuration is used for signature verification.
Type: String
Parameter Sets: AuthenticationMethod
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe path to a file containing an X.509 certificate for RSA/ECDSA signature verification.
Type: String
Parameter Sets: CertFile
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseA subject name to retrieve a certificate from the Windows certificate store.
Type: String
Parameter Sets: CertName
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseA SecureString containing a password for the certificate file, if required.
Type: SecureString
Parameter Sets: CertFile
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe location of the Windows certificate store to search (default: CurrentUser).
Type: StoreLocation
Parameter Sets: CertThumb, CertName
Aliases:
Accepted values: CurrentUser, LocalMachine
Required: False
Position: Named
Default value: CurrentUser
Accept pipeline input: False
Accept wildcard characters: FalseThe name of the Windows certificate store to search (default: My).
Type: StoreName
Parameter Sets: CertThumb, CertName
Aliases:
Accepted values: AddressBook, AuthRoot, CertificateAuthority, Disallowed, My, Root, TrustedPeople, TrustedPublisher
Required: False
Position: Named
Default value: My
Accept pipeline input: False
Accept wildcard characters: FalseA thumbprint to retrieve a certificate from the Windows certificate store.
Type: String
Parameter Sets: CertThumb
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseConverts UNIX timestamps (e.g., iat, nbf, exp) into DateTime objects for easier reading.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseIndicates that the JWT token signature should be ignored and the payload returned directly without verification.
Type: SwitchParameter
Parameter Sets: Default, Ignore
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseDetermines which parts of the JWT should be returned: Header, Payload, Signature, or any combination thereof. Defaults to 'Payload'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Payload
Accept pipeline input: False
Accept wildcard characters: FalseThe path to a PEM key file that pairs with the certificate for RSA/ECDSA signature verification.
Type: String
Parameter Sets: CertFile
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the RSA padding scheme to use (Pkcs1V15 or Pss). Defaults to Pkcs1V15.
Type: String
Parameter Sets: CertFile, CertRaw, CertThumb, CertName
Aliases:
Required: False
Position: Named
Default value: Pkcs1V15
Accept pipeline input: False
Accept wildcard characters: FalseA string or byte array used for HMAC-based signature verification.
Type: Object
Parameter Sets: Secret
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe JWT token to be decoded and optionally verified.
Type: String
Parameter Sets: AuthenticationMethod
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseType: String
Parameter Sets: Ignore, CertFile, CertRaw, CertThumb, CertName, Secret
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseA raw X.509 certificate object used for RSA/ECDSA signature verification.
Type: X509Certificate2
Parameter Sets: CertRaw
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
- This function is tailored for use with Pode, a PowerShell web server framework.
- When signature verification is enabled, the appropriate key or certificate must be provided.
- Use HTTPS in production to safeguard tokens.