Module: Ditty::Services::Authentication
- Defined in:
- lib/ditty/services/authentication.rb
Class Method Summary collapse
- .config ⇒ Object
- .default ⇒ Object
- .providers ⇒ Object
- .provides?(provider) ⇒ Boolean
- .setup ⇒ Object
Class Method Details
.config ⇒ Object
26 27 28 |
# File 'lib/ditty/services/authentication.rb', line 26 def config default.merge Ditty::Services::Settings.values(:authentication) || {} end |
.default ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ditty/services/authentication.rb', line 34 def default { identity: { arguments: [ { 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 |
.providers ⇒ Object
16 17 18 |
# File 'lib/ditty/services/authentication.rb', line 16 def providers config.keys end |
.provides?(provider) ⇒ Boolean
30 31 32 |
# File 'lib/ditty/services/authentication.rb', line 30 def provides?(provider) providers.include? provider.to_sym end |
.setup ⇒ Object
20 21 22 23 24 |
# File 'lib/ditty/services/authentication.rb', line 20 def setup providers.each do |provider| require "omniauth/#{provider}" end end |