maestrano 1.0.0.pre.RC5 → 1.0.0.pre.RC6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 026f33b3cb669405a068fd77f74860e6767950d8
4
- data.tar.gz: 6a04ca35d44ddeb69ba115f09d43157c6cb55b6a
3
+ metadata.gz: b720f84401056435fcd026e06a127783a0dc3c07
4
+ data.tar.gz: 5e6e7e0b88f4aefe47de983c8bf178e5056fa8fb
5
5
  SHA512:
6
- metadata.gz: 83aa95476fd6c663d3a091fe521c6f917fc925dbd16b315663b47cc486ddd301af58b01a987421992feb99714d8aa5b368a62a150e803c657f4210879a6bde06
7
- data.tar.gz: a2b69dadf460026c307716e57466225071a34fbd01cd6d98bdc80226ffe481c6b8630eb6def6824b4d372283430f1184711d0289926745026b25261a10502545
6
+ metadata.gz: 24c500254104e9935c15a349989936e8fb3e51f6c726af7e28668f9c2e40691dd5e805a87db610bf9964f02893dce8412655745f5655c90941284d09c290fff3
7
+ data.tar.gz: 8d012ab2d904f05737e72695584dddea8175957d7d924040537a138823889d2df5812fb008ea0eb676b3c0df4305f192796fa51ccb14ab52274742b601673028
data/lib/maestrano.rb CHANGED
@@ -188,8 +188,8 @@ module Maestrano
188
188
  token: nil,
189
189
  version: nil,
190
190
  verify_ssl_certs: false,
191
- lang: nil, #set in post_initialize
192
- lang_version: nil #set in post_initialize
191
+ lang: nil, # set in post_initialize
192
+ lang_version: nil # set in post_initialize
193
193
  })
194
194
 
195
195
  # SSO Config
@@ -199,6 +199,7 @@ module Maestrano
199
199
  creation_mode: 'real',
200
200
  init_path: '/maestrano/auth/saml/init',
201
201
  consume_path: '/maestrano/auth/saml/consume',
202
+ name_id_format: nil, # set in post_initialize
202
203
  idm: nil
203
204
  })
204
205
 
@@ -228,7 +229,10 @@ module Maestrano
228
229
  self.api.lang = 'ruby'
229
230
  self.api.lang_version = "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})"
230
231
  self.sso.idm ||= self.app.host
232
+ self.sso.name_id_format ||= Maestrano::Saml::Settings::NAMEID_PERSISTENT
231
233
  self.sso.slo_enabled &&= self.sso.enabled
234
+ self.connec.base_path ||= '/api/v2' unless self.environment == 'test' # Sandbox has a different endpoint
235
+ self.connec.timeout ||= 60
232
236
  end
233
237
 
234
238
  # Transform legacy parameters into new parameter
data/lib/maestrano/sso.rb CHANGED
@@ -60,7 +60,7 @@ module Maestrano
60
60
  return "#{host}#{api_base}#{endpoint}"
61
61
  end
62
62
 
63
- def self.session_check_url(user_uid,sso_session)
63
+ def self.session_check_url(user_uid, sso_session)
64
64
  host = Maestrano[preset].param('api.host')
65
65
  api_base = Maestrano[preset].param('api.base')
66
66
  endpoint = 'auth/saml'
@@ -14,7 +14,7 @@ module Maestrano
14
14
  # end
15
15
  raise NoMethodError, "You need to override find_for_maestrano_auth in your #{self.class.name} model"
16
16
  end
17
-
17
+
18
18
  # Check whether the user is a maestrano one
19
19
  def maestrano?
20
20
  if self.respond_to?(:provider)
@@ -23,12 +23,12 @@ module Maestrano
23
23
  raise NoMethodError, "You need to override maestrano? in your #{self.class.name} model"
24
24
  end
25
25
  end
26
-
26
+
27
27
  # Check whether the SSO session is still valid
28
28
  # or not
29
- def maestrano_session_valid?(session)
30
- Maestrano::SSO::Session.new(session).valid?
29
+ def maestrano_session_valid?(session, preset = nil)
30
+ Maestrano::SSO::Session[preset].new(session).valid?
31
31
  end
32
32
  end
33
33
  end
34
- end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Maestrano
2
- VERSION = '1.0.0.pre.RC5'
2
+ VERSION = '1.0.0.pre.RC6'
3
3
  end
@@ -94,6 +94,7 @@ class MaestranoTest < Test::Unit::TestCase
94
94
 
95
95
  context "with environment params" do
96
96
  should "return the right test parameters" do
97
+ Maestrano.reset!
97
98
  Maestrano.configure { |config| config.environment = 'test' }
98
99
 
99
100
  ['api.host', 'api.base', 'sso.idp', 'sso.name_id_format', 'sso.x509_certificate', 'connec.host', 'connec.base_path'].each do |parameter|
@@ -230,6 +231,7 @@ class MaestranoTest < Test::Unit::TestCase
230
231
 
231
232
  context "with environment params" do
232
233
  should "return the right test parameters" do
234
+ @preset = 'test'
233
235
  Maestrano[@preset].configure { |config| config.environment = 'test' }
234
236
 
235
237
  ['api.host','api.base','sso.idp', 'sso.name_id_format', 'sso.x509_certificate', 'connec.host','connec.base_path'].each do |parameter|
@@ -509,5 +511,4 @@ class MaestranoTest < Test::Unit::TestCase
509
511
  assert_equal expected, Maestrano.to_metadata
510
512
  end
511
513
  end
512
-
513
514
  end
@@ -9,14 +9,14 @@ module Maestrano
9
9
  include Maestrano::SSO::User
10
10
  end
11
11
  end
12
-
12
+
13
13
  context "find_for_maestrano_auth" do
14
14
  should "raise an error if not overriden" do
15
15
  assert_raise(NoMethodError.new("You need to override find_for_maestrano_auth in your Mocha::Mock model")) do
16
16
  @user.find_for_maestrano_auth({})
17
17
  end
18
18
  end
19
-
19
+
20
20
  should "execute properly otherwise" do
21
21
  def @user.find_for_maestrano_auth(auth); return true; end
22
22
  assert_nothing_thrown do
@@ -24,25 +24,25 @@ module Maestrano
24
24
  end
25
25
  end
26
26
  end
27
-
27
+
28
28
  context "maestrano?" do
29
29
  should "raise an error if no provider attribute and not overriden" do
30
30
  assert_raise(NoMethodError.new("You need to override maestrano? in your Mocha::Mock model")) do
31
31
  @user.maestrano?
32
32
  end
33
33
  end
34
-
34
+
35
35
  should "return true if the provider is 'maestrano'" do
36
36
  @user.stubs(:provider).returns('maestrano')
37
37
  assert @user.maestrano?
38
38
  end
39
-
39
+
40
40
  should "return false if the provider is something else" do
41
41
  @user.stubs(:provider).returns('someprovider')
42
42
  assert !@user.maestrano?
43
43
  end
44
44
  end
45
-
45
+
46
46
  context "maestrano_session_valid?" do
47
47
  should "return true if the sso session is valid" do
48
48
  session = {}
@@ -51,7 +51,7 @@ module Maestrano
51
51
  sso_session.stubs(:valid?).returns(true)
52
52
  assert @user.maestrano_session_valid?(session)
53
53
  end
54
-
54
+
55
55
  should "return false if the sso session is invalid" do
56
56
  session = {}
57
57
  sso_session = mock('sso_session')
@@ -62,4 +62,4 @@ module Maestrano
62
62
  end
63
63
  end
64
64
  end
65
- end
65
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maestrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.RC5
4
+ version: 1.0.0.pre.RC6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Lachaume
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-18 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client