Class: Jets::Authorizer::Base
- Inherits:
-
Lambda::Functions
- Object
- Lambda::Functions
- Jets::Authorizer::Base
- Includes:
- Dsl, Helpers::IamHelper
- Defined in:
- lib/jets/authorizer/base.rb
Instance Attribute Summary
Attributes inherited from Lambda::Functions
Class Method Summary collapse
-
.authorization_type(authorizer) ⇒ Object
Parameter: authorizer: Example: “main#protect”.
- .process(event, context, meth) ⇒ Object
Methods inherited from Lambda::Functions
inherited, #initialize, output_keys, subclasses
Methods included from Lambda::Dsl
Constructor Details
This class inherits a constructor from Jets::Lambda::Functions
Class Method Details
.authorization_type(authorizer) ⇒ Object
Parameter: authorizer: Example: “main#protect”
Determines authorization_type based on whether the authorizer is a Lambda or Cognito authorizer.
Returns custom or cognito_user_pools
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jets/authorizer/base.rb', line 22 def () class_name, meth = .split('#') klass = "#{class_name}_authorizer".camelize.constantize meth = meth.to_sym # If there's a lambda function associated with the authorizer then it's a custom authorizer # Otherwise it's a cognito authorizer. # # Returns: Valid values: none, aws_iam, custom, cognito_user_pools, aws_cross_account_iam methods = klass.public_instance_methods(false) methods.include?(meth) ? :custom : :cognito_user_pools end |
.process(event, context, meth) ⇒ Object
12 13 14 15 |
# File 'lib/jets/authorizer/base.rb', line 12 def process(event, context, meth) = new(event, context, meth) .send(meth) end |