Sha256: 3cb4ec508afdc6c26ca73e4e2c3814f607fac9c73b95942d23bd447814aa1689

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require 'rack/protection'
use Rack::Session::Cookie,
    key: '_Ditty_session',
    # :secure=>!TEST_MODE, # Uncomment if only allowing https:// access
    secret: File.read('.session_secret')
use Rack::Protection::RemoteToken
use Rack::Protection::SessionHijacking

require 'ditty/components/app'
Ditty.component :app

require 'omniauth'
require 'omniauth/identity'
OmniAuth.config.logger = Ditty::Services::Logger.instance
OmniAuth.config.on_failure = proc { |env|
  OmniAuth::FailureEndpoint.new(env).redirect_to_failure
}
require 'ditty/controllers/main'
require 'ditty/models/identity'
use OmniAuth::Builder do
  # The identity provider is used by the App.
  provider :identity,
           fields: [:username],
           callback_path: '/auth/identity/callback',
           model: Ditty::Identity,
           on_login: Ditty::Main,
           on_registration: Ditty::Main,
           locate_conditions: ->(req) { { username: req['username'] } }
end

run Rack::URLMap.new Ditty::Components.routes

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ditty-0.6.0 config.ru
ditty-0.4.1 config.ru
ditty-0.4.0 config.ru
ditty-0.3.3 config.ru
ditty-0.3.2 config.ru
ditty-0.3.1 config.ru
ditty-0.3.0 config.ru
ditty-0.2.2 config.ru
ditty-0.2.1 config.ru
ditty-0.2.0 config.ru