JWT

JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. This Integration can be used to Generate New JWT Tokens, Encode and Decode Existing Ones.

Authentication & Identity Management · JWT Token Generator

Details

IDJWT
ProviderOpen Source
CategoryAuthentication & Identity Management
From Version5.5.0
Docker Imagedemisto/auth-utils:1.0.0.3562326
Supported ModulesAgentix XSIAM

README

JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. This Integration can be used to Generate New JWT Tokens, Encode and Decode Existing Ones.
This integration was integrated and tested with generic JWT authentication service.

Configure JWT in Cortex

Parameter Description Required
Your server URL The authentication server URL True
Secret Key The secret key to sign the authentication token. True
Issuer Claim The “iss” (issuer) claim identifies the principal that issued the JWT. False
Audience Claim The “aud” (audience) claim identifies the recipients that the JWT is intended for. False
Trust any certificate (not secure)   False
Use system proxy settings   False

Commands

You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

jwt-generate-access-token


Generates a JWT authorization token with an optional scope and queries the API for an access token and then returns the received API access token

Base Command

jwt-generate-access-token

Input

Argument Name Description Required
jti The “jti” (JWT ID) claim provides a unique identifier for the JWT token. Optional
iss The “iss” (issuer) claim identifies the principal that issued the JWT. Optional
aud The “aud” (audience) claim identifies the recipients that the JWT is intended for. Optional
sub The “sub” (subject) claim identifies the principal that is the subject of the JWT. Optional
scp The “scp” (scope) claim is described in OAuth 2.0 Token Exchange as an array of strings, each of which represents an OAuth Scope granted for the issued security token. Optional
iat The “iat” (issued at) claim identifies the time at which the JWT was issued. Optional
exp The “exp” (expiration time) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. Optional
nbf The “nbf” (not before) claim identifies the time before which the JWT MUST NOT be accepted for processing. Optional
additionalClaims Additional claims to include in the request. Optional
tokenTimeout Token Timeout in Seconds. Default is 300. Optional

Context Output

Path Type Description
JWT.Token.ID String The JWT Token ID
JWT.Token.AccessToken String The JWT Access Token Value
JWT.Token.AuthenticationToken String JWT Authentication Token

Command Example

!jwt-generate-access-token iss="http://example.com" sub="3233-2344-4b52-2323-fc0bfb11e673" additionalClaims="{"parameter1":"23323-323-4854-893c-b59610423ad"}" tokenTimeout="300"

Context Example

{
    "JWT": {
        "Token": {
            "AccessToken": "***",
            "AuthenticationToken": "***",
            "ID": "009eb036-1e60-43e5-aad2-1187462db0be"
        }
    }
}

Human Readable Output

Results

AccessToken AuthenticationToken ID
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjIwNTA1ODMsImlhdCI6MTYyMjA1MDI4MywianRpIjoiMDA5ZWIwMzYtMWU2MC00M2U1LWFhZDItMTE4NzQ2MmRiMGJlIiwiaXNzIjoiaHR0cDovL2V4YW1wbGUuY29tIiwic3ViIjoiMzIzMy0yMzQ0LTRiNTItMjMyMy1mYzBiZmIxMWU2NzMiLCJwYXJhbWV0ZXIxIjoiMjMzMjMtMzIzLTQ4NTQtODkzYy1iNTk2MTA0MjNhZCJ9.13zCwNhvt8fCuyHBcmdbDSaXUIpDRI95Q5-m1EbPQmk”, 009eb036-1e60-43e5-aad2-1187462db0be  

jwt-generate-authentication-payload


Generates a JWT authorization request payload by encoding the provided claims.

Base Command

jwt-generate-authentication-payload

Input

Argument Name Description Required
jti The “jti” (JWT ID) claim provides a unique identifier for the JWT token. Optional
iss The “iss” (issuer) claim identifies the principal that issued the JWT. Optional
aud The “aud” (audience) claim identifies the recipients that the JWT is intended for. Optional
sub The “sub” (subject) claim identifies the principal that is the subject of the JWT. Optional
scp The “scp” (scope) claim is described in OAuth 2.0 Token Exchange as an array of strings, each of which represents an OAuth Scope granted for the issued security token. Optional
iat The “iat” (issued at) claim identifies the time at which the JWT was issued. Optional
exp The “exp” (expiration time) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. . Optional
nbf The “nbf” (not before) claim identifies the time before which the JWT MUST NOT be accepted for processing. Optional
additionalClaims Additional claims to include in the request. Optional
tokenTimeout Token Timeout in Seconds. Default is 300. Optional

Context Output

Path Type Description
JWT.Token.ID String The JWT Token ID
JWT.Token.AuthenticationToken String The JWT Authentication Token Value

Command Example

!jwt-generate-authentication-payload iss="http://example.com" sub="3233-2344-4b52-2323-fc0bfb11e673" additionalClaims=`{"parameter1":"23323-323-4854-893c-b59610423ad"}`

Context Example

{
    "JWT": {
        "Token": {
            "AuthenticationToken": "***",
            "ID": "66175ceb-f910-4b32-8a53-739ecf37a95d"
        }
    }
}

Human Readable Output

Results

AuthenticationToken ID
***  

jwt-decode-token


A command to decode JWT tokens

Base Command

jwt-decode-token

Input

Argument Name Description Required
token The token to decode. Required
secret The secret to validate the token signature. Optional

Context Output

There is no context output for this command.

Command Example

!jwt-decode-token token="************************************.*********************************************************************************************************************************************************************************************************************************************************************.******************************************"

Context Example

{
    "JWT": {
        "DecodedToken": {
            "exp": 1622050583,
            "iat": 1622050283,
            "iss": "http://example.com",
            "jti": "009eb036-1e60-43e5-aad2-1187462db0be",
            "parameter1": "23323-323-4854-893c-b59610423ad",
            "sub": "3233-2344-4b52-2323-fc0bfb11e673"
        }
    }
}

Human Readable Output

Results

exp iat iss jti parameter1 sub
1622050583 1622050283 http://example.com 009eb036-1e60-43e5-aad2-1187462db0be 23323-323-4854-893c-b59610423ad 3233-2344-4b52-2323-fc0bfb11e673

Configuration parameters

  • url — Your server URL (required)
  • key — Secret Key (required)
  • algorithm — Algorithm
  • iss — Issuer
  • aud — Audience
  • jti — Token ID
  • sub — Subject
  • scp — Scope
  • iat — Issued At
  • exp — Expiration Time
  • nbf — Not Before
  • additionalClaims — Additional Claims
  • tokenTimeout — Token Timeout
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (3)

  • jwt-decode-token

    A command to decode JWT tokens

  • jwt-generate-access-token

    Generates a JWT authorization token with an optional scope and queries the API for an access token and then returns the received API access token

  • jwt-generate-authentication-payload

    Generates a JWT authorization request payload by encoding the provided claims.

category: Authentication & Identity Management
provider: Open Source
commonfields:
  id: JWT
  version: -1
configuration:
- additionalinfo: The authentication server URL
  defaultvalue: https://example.com/
  display: Your server URL
  name: url
  required: true
  type: 0
- additionalinfo: The secret key to sign the authentication token.
  display: Secret Key
  name: key
  required: true
  type: 4
- additionalinfo: Token Signing Algorithm.
  defaultvalue: HS256
  display: Algorithm
  name: algorithm
  type: 0
  required: false
- additionalinfo: The “iss” (issuer) claim identifies the principal that issued the JWT.
  display: Issuer
  name: iss
  type: 0
  required: false
- additionalinfo: The “aud” (audience) claim identifies the recipients that the JWT is intended for.
  display: Audience
  name: aud
  type: 0
  required: false
- additionalinfo: The "jti" (JWT ID) claim provides a unique identifier for the JWT token.
  display: Token ID
  name: jti
  type: 0
  required: false
- additionalinfo: The "sub" (subject) claim identifies the principal that is the subject of the JWT.
  display: Subject
  name: sub
  type: 0
  required: false
- additionalinfo: The "scp" (scope) claim is described in OAuth 2.0 Token Exchange as an array of strings, each of which represents an OAuth Scope granted for the issued security token.
  display: Scope
  name: scp
  type: 0
  required: false
- additionalinfo: The "iat" (issued at) claim identifies the time at which the JWT was issued.
  display: Issued At
  name: iat
  type: 0
  required: false
- additionalinfo: The "exp" (expiration time) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing.
  display: Expiration Time
  name: exp
  type: 0
  required: false
- additionalinfo: The "nbf" (not before) claim identifies the time before which the JWT MUST NOT be accepted for processing.
  display: Not Before
  name: nbf
  type: 0
  required: false
- additionalinfo: Additional claims to include in the request.
  display: Additional Claims
  name: additionalClaims
  type: 12
  required: false
- additionalinfo: Token Timeout in Seconds
  defaultvalue: '300'
  display: Token Timeout
  name: tokenTimeout
  type: 0
  required: false
- display: Trust any certificate (not secure)
  name: insecure
  type: 8
  required: false
- display: Use system proxy settings
  name: proxy
  type: 8
  required: false
description: JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. This Integration can be used to Generate New JWT Tokens, Encode and Decode Existing Ones.
display: JWT
name: JWT
script:
  commands:
  - arguments:
    - description: The "jti" (JWT ID) claim provides a unique identifier for the JWT token.
      name: jti
    - description: The "iss" (issuer) claim identifies the principal that issued the JWT.
      name: iss
    - description: The "aud" (audience) claim identifies the recipients that the JWT is intended for.
      name: aud
    - description: The "sub" (subject) claim identifies the principal that is the subject of the JWT.
      name: sub
    - description: The "scp" (scope) claim is described in OAuth 2.0 Token Exchange as an array of strings, each of which represents an OAuth Scope granted for the issued security token.
      name: scp
    - description: The "iat" (issued at) claim identifies the time at which the JWT was issued.
      name: iat
    - description: The "exp" (expiration time) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing.
      name: exp
    - description: The "nbf" (not before) claim identifies the time before which the JWT MUST NOT be accepted for processing.
      name: nbf
    - description: Additional claims to include in the request.
      name: additionalClaims
    - default: true
      defaultValue: '300'
      description: Token Timeout in Seconds.
      name: tokenTimeout
    - defaultValue: HS256
      description: Token Signing Algorithm.
      name: algorithm
    description: Generates a JWT authorization token with an optional scope and queries the API for an access token and then returns the received API access token
    name: jwt-generate-access-token
    outputs:
    - contextPath: JWT.Token.ID
      description: The JWT Token ID.
      type: String
    - contextPath: JWT.Token.AccessToken
      description: The JWT Access Token Value.
      type: String
    - contextPath: JWT.Token.AuthenticationToken
      description: JWT Authentication Token.
      type: String
  - arguments:
    - description: The "jti" (JWT ID) claim provides a unique identifier for the JWT token.
      name: jti
    - description: The "iss" (issuer) claim identifies the principal that issued the JWT.
      name: iss
    - description: The "aud" (audience) claim identifies the recipients that the JWT is intended for.
      name: aud
    - description: The "sub" (subject) claim identifies the principal that is the subject of the JWT.
      name: sub
    - description: The "scp" (scope) claim is described in OAuth 2.0 Token Exchange as an array of strings, each of which represents an OAuth Scope granted for the issued security token.
      name: scp
    - description: The "iat" (issued at) claim identifies the time at which the JWT was issued.
      name: iat
    - description: 'The "exp" (expiration time) claim identifies the expiration time on or after which the JWT MUST NOT be accepted for processing. '
      name: exp
    - description: The "nbf" (not before) claim identifies the time before which the JWT MUST NOT be accepted for processing.
      name: nbf
    - description: Additional claims to include in the request.
      name: additionalClaims
    - default: true
      defaultValue: '300'
      description: Token Timeout in Seconds.
      name: tokenTimeout
    - defaultValue: HS256
      description: Token Signing Algorithm.
      name: algorithm
    description: Generates a JWT authorization request payload by encoding the provided claims.
    name: jwt-generate-authentication-payload
    outputs:
    - contextPath: JWT.Token.ID
      description: The JWT Token ID.
      type: String
    - contextPath: JWT.Token.AuthenticationToken
      description: The JWT Authentication Token Value.
      type: String
  - arguments:
    - description: The token to decode.
      name: token
      required: true
    - description: The secret to validate the token signature.
      name: secret
    description: A command to decode JWT tokens
    name: jwt-decode-token
  dockerimage: demisto/auth-utils:1.0.0.3562326
  runonce: false
  script: '-'
  subtype: python3
  type: python
tests:
- No tests (auto formatted)
fromversion: 5.5.0