Class: Cerbos::Input::JWT

Inherits:
Object
  • Object
show all
Defined in:
lib/cerbos/input/jwt.rb

Overview

A JSON Web Token to use as an auxiliary data source, which will be verified against the Cerbos policy decision point (PDP) server's configured JSON Web Key Sets (JWKS) unless verification is disabled on the server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token:, key_set_id: nil) ⇒ JWT

Specify a JWT to use as an auxiliary data source.

Parameters:

  • token (String)

    the encoded JWT.

  • key_set_id (String, nil) (defaults to: nil)

    the ID of the JWKS to be used by the PDP server to verify the JWT. May be set to nil if the PDP server only has one JWKS configured or verification disabled.



24
25
26
27
# File 'lib/cerbos/input/jwt.rb', line 24

def initialize(token:, key_set_id: nil)
  @token = token
  @key_set_id = key_set_id
end

Instance Attribute Details

#key_set_idString? (readonly)

The ID of the JWKS to be used by the PDP server to verify the JWT.

Returns:

  • (String)
  • (nil)

    if not provided (in which case the PDP server must have only one JWKS configured or verification disabled).



18
19
20
# File 'lib/cerbos/input/jwt.rb', line 18

def key_set_id
  @key_set_id
end

#tokenString (readonly)

The encoded JWT.

Returns:

  • (String)


12
13
14
# File 'lib/cerbos/input/jwt.rb', line 12

def token
  @token
end