Class: Cerbos::Input::AuxData

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

Overview

Auxiliary data sources that can be referenced in policy conditions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jwt: nil, jwts: {}) ⇒ AuxData

Specify auxiliary data sources.

Parameters:

  • jwt (JWT, Hash, nil) (defaults to: nil)

    a JSON Web Token (JWT) to use as an auxiliary data source (mutually exclusive with jwts).

  • jwts (Hash{String, Symbol => JWT, Hash}) (defaults to: {})

    named JSON Web Tokens (JWTs) to use as auxiliary data sources (mutually exclusive with jwts).



22
23
24
25
# File 'lib/cerbos/input/aux_data.rb', line 22

def initialize(jwt: nil, jwts: {})
  @jwt = Input.coerce_optional(jwt, JWT)
  @jwts = Input.coerce_map(jwts, JWT)
end

Instance Attribute Details

#jwtJWT? (readonly)

A JSON Web Token (JWT) to use as an auxiliary data source.

Returns:

  • (JWT)
  • (nil)

    if not provided.



11
12
13
# File 'lib/cerbos/input/aux_data.rb', line 11

def jwt
  @jwt
end

#jwtsHash{String => JWT} (readonly)

Named JSON Web Tokens (JWTs) to use as auxiliary data sources.

Returns:

  • (Hash{String => JWT})


16
17
18
# File 'lib/cerbos/input/aux_data.rb', line 16

def jwts
  @jwts
end