Module: Warden::Cognito

Extended by:
Dry::Configurable
Defined in:
lib/warden/cognito.rb,
lib/warden/cognito/version.rb,
lib/warden/cognito/jwk_loader.rb,
lib/warden/cognito/user_helper.rb,
lib/warden/cognito/test_helpers.rb,
lib/warden/cognito/token_decoder.rb,
lib/warden/cognito/cognito_client.rb,
lib/warden/cognito/local_user_mapper.rb,
lib/warden/cognito/user_not_found_callback.rb,
lib/warden/cognito/authenticatable_strategy.rb,
lib/warden/cognito/has_user_pool_identifier.rb,
lib/warden/cognito/token_authenticatable_strategy.rb

Defined Under Namespace

Modules: HasUserPoolIdentifier Classes: AuthenticatableStrategy, CognitoClient, CognitoError, JwkLoader, LocalUserMapper, TestHelpers, TokenAuthenticatableStrategy, TokenDecoder, UserHelper, UserNotFoundCallback

Constant Summary collapse

Import =
Dry::AutoInject(config)
VERSION =
'1.0.0'.freeze

Class Method Summary collapse

Class Method Details

.jwk_config_keysObject



16
17
18
# File 'lib/warden/cognito.rb', line 16

def jwk_config_keys
  %i[key issuer]
end

.jwk_instance(value) ⇒ Object



20
21
22
23
# File 'lib/warden/cognito.rb', line 20

def jwk_instance(value)
  attributes = value&.symbolize_keys&.slice(*jwk_config_keys) || {}
  Struct.new(*jwk_config_keys, keyword_init: true).new(attributes)
end

.user_pool_configuration_keysObject



25
26
27
# File 'lib/warden/cognito.rb', line 25

def user_pool_configuration_keys
  %i[identifier region pool_id client_id]
end

.user_pool_configurations(value) ⇒ Object



29
30
31
32
33
34
# File 'lib/warden/cognito.rb', line 29

def user_pool_configurations(value)
  value.map do |key, conf|
    attributes = conf.symbolize_keys.slice(*user_pool_configuration_keys).merge(identifier: key)
    Struct.new(*user_pool_configuration_keys, keyword_init: true).new(attributes)
  end
end