Class: KeycloakRack::WrapToken

Inherits:
Object
  • Object
show all
Defined in:
lib/keycloak_rack/wrap_token.rb

Overview

Wrap the result of DecodeAndVerify#call in a class that provides a unified interface for introspecting a Keycloak JWT.

Instance Method Summary collapse

Instance Method Details

#call(payload, headers) ⇒ Dry::Monads::Success(KeycloakRack::DecodedToken)

Parameters:

  • payload (Hash)
  • headers (Hash)

Returns:



12
13
14
15
16
17
18
19
20
# File 'lib/keycloak_rack/wrap_token.rb', line 12

def call(payload, headers)
  raw_attributes = payload.merge(original_payload: payload, headers: headers)

  Success DecodedToken.new raw_attributes
rescue Dry::Struct::Error => e
  handle_struct_error e
rescue StandardError => e
  unknown_failure e
end