Class: RailsSso::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_sso/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
25
26
27
28
29
30
# File 'lib/rails_sso/configuration.rb', line 22

def initialize
  self.application_controller = "ApplicationController"
  self.magic_enabled = true
  self.use_cache = false
  self.test_mode = false
  self.profile_mocks = {}
  self.access_token_mock = nil
  self.failure_app = RailsSso::FailureApp
end

Instance Attribute Details

#access_token_mockObject

Returns the value of attribute access_token_mock.



18
19
20
# File 'lib/rails_sso/configuration.rb', line 18

def access_token_mock
  @access_token_mock
end

#application_controllerObject

Returns the value of attribute application_controller.



3
4
5
# File 'lib/rails_sso/configuration.rb', line 3

def application_controller
  @application_controller
end

#failure_appObject

Returns the value of attribute failure_app.



20
21
22
# File 'lib/rails_sso/configuration.rb', line 20

def failure_app
  @failure_app
end

#magic_enabledObject

Returns the value of attribute magic_enabled.



4
5
6
# File 'lib/rails_sso/configuration.rb', line 4

def magic_enabled
  @magic_enabled
end

#profile_mocksObject

Returns the value of attribute profile_mocks.



17
18
19
# File 'lib/rails_sso/configuration.rb', line 17

def profile_mocks
  @profile_mocks
end

#provider_keyObject

Returns the value of attribute provider_key.



8
9
10
# File 'lib/rails_sso/configuration.rb', line 8

def provider_key
  @provider_key
end

#provider_nameObject

Returns the value of attribute provider_name.



7
8
9
# File 'lib/rails_sso/configuration.rb', line 7

def provider_name
  @provider_name
end

#provider_profile_pathObject

Returns the value of attribute provider_profile_path.



11
12
13
# File 'lib/rails_sso/configuration.rb', line 11

def provider_profile_path
  @provider_profile_path
end

#provider_secretObject

Returns the value of attribute provider_secret.



9
10
11
# File 'lib/rails_sso/configuration.rb', line 9

def provider_secret
  @provider_secret
end

#provider_sign_out_pathObject

Returns the value of attribute provider_sign_out_path.



12
13
14
# File 'lib/rails_sso/configuration.rb', line 12

def provider_sign_out_path
  @provider_sign_out_path
end

#provider_urlObject



55
56
57
58
59
# File 'lib/rails_sso/configuration.rb', line 55

def provider_url
  fail RailsSso::Error, "Provider url not set!" if @provider_url.nil?

  @provider_url
end

#test_modeObject

Returns the value of attribute test_mode.



16
17
18
# File 'lib/rails_sso/configuration.rb', line 16

def test_mode
  @test_mode
end

#use_cacheObject

Returns the value of attribute use_cache.



14
15
16
# File 'lib/rails_sso/configuration.rb', line 14

def use_cache
  @use_cache
end

Instance Method Details

#oauth2_strategy_classObject



36
37
38
# File 'lib/rails_sso/configuration.rb', line 36

def oauth2_strategy_class
  OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(provider_name.to_s)}")
end

#profile_mockObject



45
46
47
48
49
# File 'lib/rails_sso/configuration.rb', line 45

def profile_mock
  profile_mocks.fetch(access_token_mock) do
    fail %Q{Mock "#{access_token_mock}" has not been setup!}
  end
end

#provider_callback_pathObject



32
33
34
# File 'lib/rails_sso/configuration.rb', line 32

def provider_callback_path
  "/sso/#{provider_name}/callback"
end

#test_mode?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/rails_sso/configuration.rb', line 51

def test_mode?
  @test_mode
end