Class: NginxOmniauthAdapter::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/nginx_omniauth_adapter/app.rb

Constant Summary collapse

CONTEXT_RACK_ENV_NAME =
'nginx-omniauth-adapter'.freeze
SESSION_PASS_CIPHER_ALGORITHM =
'aes-256-gcm'.freeze

Class Method Summary collapse

Class Method Details

.initialize_context(config) ⇒ Object


15
16
17
18
19
# File 'lib/nginx_omniauth_adapter/app.rb', line 15

def self.initialize_context(config)
  {}.tap do |ctx|
    ctx[:config] = config
  end
end

.rack(config = {}) ⇒ Object


21
22
23
24
25
26
27
28
29
# File 'lib/nginx_omniauth_adapter/app.rb', line 21

def self.rack(config={})
  klass = self

  context = initialize_context(config)
  app = lambda { |env|
    env[CONTEXT_RACK_ENV_NAME] = context
    klass.call(env)
  }
end