en-US/PSJwt-help.xml

<?xml version="1.0" encoding="utf-8"?>
<helpItems schema="maml" xmlns="http://msh">
  <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
    <command:details>
      <command:name>ConvertFrom-JWT</command:name>
      <command:verb>ConvertFrom</command:verb>
      <command:noun>JWT</command:noun>
      <maml:description>
        <maml:para>Parsing (decoding) and verifying JSON Web Token</maml:para>
      </maml:description>
    </command:details>
    <maml:description>
      <maml:para>Decodes JSON Web Token.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>ConvertFrom-JWT</maml:name>
        <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none">
          <maml:name>Token</maml:name>
          <maml:Description>
            <maml:para>JSON Web Token</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters>
      <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="0" aliases="none">
        <maml:name>Token</maml:name>
        <maml:Description>
          <maml:para>JSON Web Token</maml:para>
        </maml:Description>
        <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
        <dev:type>
          <maml:name>String</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
    </command:parameters>
    <command:inputTypes>
      <command:inputType>
        <dev:type>
          <maml:name>None</maml:name>
        </dev:type>
        <maml:description>
          <maml:para></maml:para>
        </maml:description>
      </command:inputType>
    </command:inputTypes>
    <command:returnValues>
      <command:returnValue>
        <dev:type>
          <maml:name>System.String</maml:name>
        </dev:type>
        <maml:description>
          <maml:para></maml:para>
        </maml:description>
      </command:returnValue>
    </command:returnValues>
    <maml:alertSet>
      <maml:alert>
        <maml:para></maml:para>
      </maml:alert>
    </maml:alertSet>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- Example 1 --------------------------</maml:title>
        <dev:code>PS C:\&gt; $Token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJGaXJzdE5hbWUiOiJTdGVmYW4iLCJMYXN0TmFtZSI6IlN0cmFuZ2VyIiwiRGVtbyI6IkVuY29kZSBBY2Nlc3MgVG9rZW4iLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.8-YqAPPth3o-C_xO9WFjW5RViAnDe2WrmVyqLRnNEV0'
ConvertFrom-JWT -Token $Token
Header Payload
------ -------
@{typ=JWT; alg=HS256} @{FirstName=Stefan; LastName=Stranger; Demo=Encode Access Token; exp=1393286893; iat=1393268893}</dev:code>
        <dev:remarks>
          <maml:para>Decoded JSON Web Token.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- Example 2 --------------------------</maml:title>
        <dev:code>PS C:\&gt; $Token = 'eyJFbnYiOiJEZW1vIiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJpYXQiOiIxMzkzMjY4ODkzIiwiRGVtbyI6IkVuY29kZSBBY2Nlc3MgVG9rZW4iLCJGaXJzdE5hbWUiOiJTdGVmYW4iLCJleHAiOiIxMzkzMjg2ODkzIiwiTGFzdE5hbWUiOiJTdHJhbmdlciJ9.JFJVUaBIUJmHQUawkK1dH5Iie8tSTTXKFbZZka3_k7Y'
ConvertFrom-JWT -Token $Token
Header Payload
------ -------
@{Env=Demo; typ=JWT; alg=HS256} @{iat=1393268893; Demo=Encode Access Token; FirstName=Stefan; exp=1393286893; LastName=Stranger}</dev:code>
        <dev:remarks>
          <maml:para>Decoded JSON Web Token with extra header info.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- Example 3 --------------------------</maml:title>
        <dev:code>PS C:\&gt; $Token = 'eyJFbnYiOiJEZW1vIiwidHlwIjoiSldUIiwiYWxnIjoiSFMyNTYifQ.eyJpYXQiOiIxMzkzMjY4ODkzIiwiRGVtbyI6IkVuY29kZSBBY2Nlc3MgVG9rZW4iLCJGaXJzdE5hbWUiOiJTdGVmYW4iLCJleHAiOiIxMzkzMjg2ODkzIiwiTGFzdE5hbWUiOiJTdHJhbmdlciJ9.JFJVUaBIUJmHQUawkK1dH5Iie8tSTTXKFbZZka3_k7Y'
ConvertFrom-JWT -Token $Token | Select-Object -Expand Payload | Select-Object @{'Name' = 'iatutc'; E= {[system.dateTimeOffset]::FromUnixTimeSeconds($_.iat).datetime}},@{'Name' = 'exptutc'; E= {[system.dateTimeOffset]::FromUnixTimeSeconds($_.exp).datetime}}
iatutc exptutc
------ -------
24-2-2014 19:08:13 25-2-2014 00:08:13</dev:code>
        <dev:remarks>
          <maml:para>Decoded JSON Web Token with conversation of Unix Time.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <command:relatedLinks />
  </command:command>
  <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
    <command:details>
      <command:name>ConvertTo-JWT</command:name>
      <command:verb>ConvertTo</command:verb>
      <command:noun>JWT</command:noun>
      <maml:description>
        <maml:para>Creating (encoding) JSON Web Token</maml:para>
      </maml:description>
    </command:details>
    <maml:description>
      <maml:para>Encodes payload to encoded JSON Web Token.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>ConvertTo-JWT</maml:name>
        <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none">
          <maml:name>PayLoad</maml:name>
          <maml:Description>
            <maml:para>Payload, which contains the claims. Claims are statements about an entity (typically, the user) and additional data. There are three types of claims: registered, public, and private claims. The payload needs to be dictionary (HashTable) object.</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">Hashtable</command:parameterValue>
          <dev:type>
            <maml:name>Hashtable</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
          <maml:name>Secret</maml:name>
          <maml:Description>
            <maml:para>JWTs can be signed using a secret (with the HMAC algorithm).</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
          <maml:name>Header</maml:name>
          <maml:Description>
            <maml:para>The header typically consists of two parts: the type of the token, which is JWT, and the signing algorithm being used, such as HMAC SHA256 or RSA. With the Header parameter you can add extra header information. The header needs to be dictionary (HashTable) object.</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">Hashtable</command:parameterValue>
          <dev:type>
            <maml:name>Hashtable</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters>
      <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="0" aliases="none">
        <maml:name>PayLoad</maml:name>
        <maml:Description>
          <maml:para>Payload, which contains the claims. Claims are statements about an entity (typically, the user) and additional data. There are three types of claims: registered, public, and private claims. The payload needs to be dictionary (HashTable) object.</maml:para>
        </maml:Description>
        <command:parameterValue required="true" variableLength="false">Hashtable</command:parameterValue>
        <dev:type>
          <maml:name>Hashtable</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
      <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
        <maml:name>Secret</maml:name>
        <maml:Description>
          <maml:para>JWTs can be signed using a secret (with the HMAC algorithm).</maml:para>
        </maml:Description>
        <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
        <dev:type>
          <maml:name>String</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
        <maml:name>Header</maml:name>
        <maml:Description>
          <maml:para>The header typically consists of two parts: the type of the token, which is JWT, and the signing algorithm being used, such as HMAC SHA256 or RSA. With the Header parameter you can add extra header information. The header needs to be dictionary (HashTable) object.</maml:para>
        </maml:Description>
        <command:parameterValue required="true" variableLength="false">Hashtable</command:parameterValue>
        <dev:type>
          <maml:name>Hashtable</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
    </command:parameters>
    <command:inputTypes>
      <command:inputType>
        <dev:type>
          <maml:name>System.Collections.Hashtable</maml:name>
        </dev:type>
        <maml:description>
          <maml:para></maml:para>
        </maml:description>
      </command:inputType>
    </command:inputTypes>
    <command:returnValues>
      <command:returnValue>
        <dev:type>
          <maml:name>System.String</maml:name>
        </dev:type>
        <maml:description>
          <maml:para></maml:para>
        </maml:description>
      </command:returnValue>
    </command:returnValues>
    <maml:alertSet>
      <maml:alert>
        <maml:para></maml:para>
      </maml:alert>
    </maml:alertSet>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- Example 1 --------------------------</maml:title>
        <dev:code>PS C:\&gt; @{'FirstName' = 'Stefan'; 'LastName' = 'Stranger'; 'Demo' = 'Encode Access Token'; 'exp' = '1393286893'; 'iat' = '1393268893'} | ConvertTo-Jwt -secret 'qwerty'</dev:code>
        <dev:remarks>
          <maml:para>Encodes Dictionary (Hashtable) payload to encoded JSON Web Token.</maml:para>
        </dev:remarks>
      </command:example>
      <command:example>
        <maml:title>-------------------------- Example 2 --------------------------</maml:title>
        <dev:code>PS C:\&gt; $Payload = @{'FirstName' = 'Stefan'; 'LastName' = 'Stranger'; 'Demo' = 'Encode Access Token'; 'exp' = '1393286893'; 'iat' = '1393268893'}
PS C:\&gt; $Header = @{'Env' = 'Demo'}
PS C:\&gt; $Secret = 'qwerty'
PS C:\&gt;ConvertTo-Jwt -Payload $Payload -Header $Header -Secret $Secret</dev:code>
        <dev:remarks>
          <maml:para>Encodes Dictionary (Hashtable) payload with extra header info to encoded JSON Web Token.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <command:relatedLinks />
  </command:command>
</helpItems>