class Authinator::Configuration
Configuration
class
Attributes
providers[R]
valid_applications[RW]
Public Class Methods
new()
click to toggle source
# File lib/authinator/configuration.rb, line 28 def initialize @providers = {} add_provider( :stub, client_id: 'cl_id', client_secret: 'cl_sec', site: 'https://example.org', token_url: '/extoken', api_key: 'api_key', user_info_url: 'http://example.org/info', ) add_provider( :google, site: 'https://accounts.google.com', token_url: '/o/oauth2/token', user_info_url: 'https://www.googleapis.com/plus/v1/people/me/openIdConnect', ) end
Public Instance Methods
add_provider(provider_name, options = {})
click to toggle source
# File lib/authinator/configuration.rb, line 51 def add_provider(provider_name, options = {}) @providers[provider_name] = Provider.new(provider_name, options) end
add_secrets(provider_name, options = {})
click to toggle source
# File lib/authinator/configuration.rb, line 55 def add_secrets(provider_name, options = {}) fail( ArgumentError, "#{provider_name} is not a configured provider.\n" \ "Valid Providers:\n" << providers.to_s, ) if @providers[provider_name].blank? @providers[provider_name].add_secrets(options) end
provider_for(provider_name)
click to toggle source
A more abstracted way of accessing the providers
# File lib/authinator/configuration.rb, line 67 def provider_for(provider_name) @providers[provider_name] end