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-oauth2-adapter'.freeze
SESSION_PASS_CIPHER_ALGORITHM =
'aes-256-gcm'.freeze

Class Method Summary collapse

Class Method Details

.initialize_context(config) ⇒ Object



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

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

.rack(config = {}) ⇒ Object



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

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

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