casino_core 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- casino_core (1.3.1)
4
+ casino_core (1.3.2)
5
5
  activerecord (~> 3.2.9)
6
6
  addressable (~> 2.3)
7
7
  faraday (~> 0.8)
@@ -30,7 +30,9 @@ class CASinoCore::Model::ServiceTicket::SingleSignOutNotifier
30
30
 
31
31
  def send_notification(url, xml)
32
32
  logger.info "Sending Single Sign Out notification for ticket '#{@service_ticket.ticket}'"
33
- result = Faraday.post(url, logoutRequest: xml)
33
+ result = Faraday.post(url, logoutRequest: xml) do |request|
34
+ request.options[:timeout] = CASinoCore::Settings.service_ticket[:single_sign_out_notification][:timeout]
35
+ end
34
36
  if result.success?
35
37
  logger.info "Logout notification successfully posted to #{url}."
36
38
  true
@@ -3,7 +3,7 @@ require 'casino_core/authenticator'
3
3
  module CASinoCore
4
4
  class Settings
5
5
  class << self
6
- attr_accessor :login_ticket, :ticket_granting_ticket, :service_ticket, :proxy_ticket, :two_factor_authenticator, :authenticators, :logger
6
+ attr_accessor :login_ticket, :ticket_granting_ticket, :service_ticket, :proxy_ticket, :two_factor_authenticator, :authenticators, :logger, :frontend
7
7
  DEFAULT_SETTINGS = {
8
8
  login_ticket: {
9
9
  lifetime: 600
@@ -13,7 +13,10 @@ module CASinoCore
13
13
  },
14
14
  service_ticket: {
15
15
  lifetime_unconsumed: 300,
16
- lifetime_consumed: 86400
16
+ lifetime_consumed: 86400,
17
+ single_sign_out_notification: {
18
+ timeout: 10
19
+ }
17
20
  },
18
21
  proxy_ticket: {
19
22
  lifetime_unconsumed: 300,
@@ -51,6 +54,10 @@ module CASinoCore
51
54
  end
52
55
  end
53
56
 
57
+ def add_defaults(name, config = {})
58
+ DEFAULT_SETTINGS[name] = config
59
+ end
60
+
54
61
  private
55
62
  def load_and_instantiate_authenticator(name, options)
56
63
  gemname = "casino_core-authenticator-#{name.underscore}"
@@ -1,3 +1,3 @@
1
1
  module CASinoCore
2
- VERSION = '1.3.1'
2
+ VERSION = '1.3.2'
3
3
  end
@@ -21,6 +21,13 @@ describe CASinoCore::Model::ServiceTicket::SingleSignOutNotifier do
21
21
  }
22
22
  end
23
23
 
24
+ it 'sets the timeout values' do
25
+ [:read_timeout=, :open_timeout=].each do |timeout|
26
+ Net::HTTP.any_instance.should_receive(timeout).with(10)
27
+ end
28
+ notifier.notify
29
+ end
30
+
24
31
  context 'when it is a success' do
25
32
  it 'returns true' do
26
33
  notifier.notify.should == true
@@ -10,6 +10,14 @@ describe CASinoCore::Settings do
10
10
  end
11
11
  end
12
12
 
13
+ describe '.add_defaults' do
14
+ it 'allows to set a overwritable default' do
15
+ CASinoCore::Settings.add_defaults :frontend, { foo: 'bar', example: 'test' }
16
+ CASinoCore::Settings.init frontend: { foo: 'test', test: 'example' }
17
+ CASinoCore::Settings.frontend.should == { foo: 'test', example: 'test', test: 'example' }
18
+ end
19
+ end
20
+
13
21
  describe '#authenticators=' do
14
22
  context 'with an authenticator name' do
15
23
  let(:authenticator_name) { 'testing' }
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casino_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -431,7 +431,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
431
431
  version: '0'
432
432
  segments:
433
433
  - 0
434
- hash: 4202762284368637569
434
+ hash: 1700907727997131788
435
435
  required_rubygems_version: !ruby/object:Gem::Requirement
436
436
  none: false
437
437
  requirements:
@@ -440,7 +440,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
440
440
  version: '0'
441
441
  segments:
442
442
  - 0
443
- hash: 4202762284368637569
443
+ hash: 1700907727997131788
444
444
  requirements: []
445
445
  rubyforge_project:
446
446
  rubygems_version: 1.8.24
metadata.gz.sig CHANGED
Binary file