Class: Hydra::Keycloak::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/hydra/keycloak/token.rb

Constant Summary collapse

REGISTERED_CLAIMS =
%i[iss sub aud exp nbf iat jti].freeze
PUBLIC_CLAIMS =
%i[auth_time scope].freeze
PRIVATE_CLAIMS =
%i[session_state resource_access].freeze

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Token

Returns a new instance of Token.



18
19
20
21
# File 'lib/hydra/keycloak/token.rb', line 18

def initialize(source)
  @source = source
  @data = ::JWT.decode(source, nil, false).first.transform_keys(&:to_sym)
end

Instance Method Details

#[](key) ⇒ Object



29
30
31
# File 'lib/hydra/keycloak/token.rb', line 29

def [](key)
  @data[key]
end