openid_connect 0.3.2 → 0.3.3

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
- openid_connect (0.3.1)
4
+ openid_connect (0.3.2)
5
5
  activemodel (>= 3)
6
6
  attr_required (>= 0.0.5)
7
7
  json (>= 1.4.3)
@@ -38,7 +38,6 @@ GEM
38
38
  jruby-openssl (0.7.7)
39
39
  bouncy-castle-java (>= 1.5.0146.1)
40
40
  json (1.7.5)
41
- json (1.7.5-java)
42
41
  json-jwt (0.3.0)
43
42
  activesupport (>= 2.3)
44
43
  i18n
@@ -68,7 +67,7 @@ GEM
68
67
  rspec-expectations (2.11.3)
69
68
  diff-lcs (~> 1.1.3)
70
69
  rspec-mocks (2.11.3)
71
- swd (0.1.2)
70
+ swd (0.2.0)
72
71
  activesupport (>= 3)
73
72
  attr_required (>= 0.0.5)
74
73
  httpclient (>= 2.2.1)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -1,7 +1,7 @@
1
1
  module OpenIDConnect
2
2
  module Discovery
3
3
  class Principal
4
- attr_reader :identifier, :host
4
+ attr_reader :identifier, :host, :port
5
5
 
6
6
  def self.parse(identifier)
7
7
  raise InvalidIdentifier.new('Identifier Required') if identifier.blank?
@@ -19,6 +19,7 @@ module OpenIDConnect
19
19
  :principal => identifier,
20
20
  :service => Provider::SERVICE_URI,
21
21
  :host => host,
22
+ :port => port,
22
23
  :cache => cache_options
23
24
  )
24
25
  rescue SWD::Exception => e
@@ -6,6 +6,7 @@ module OpenIDConnect
6
6
  uri = normalize(identifier)
7
7
  @identifier = uri.to_s
8
8
  @host = uri.host
9
+ @port = uri.port unless [80, 443].include?(uri.port)
9
10
  end
10
11
 
11
12
  private
@@ -31,6 +31,18 @@ describe OpenIDConnect::Discovery::Principal::URI do
31
31
  let(:identifier) { input }
32
32
  its(:identifier) { should == output }
33
33
  its(:host) { should == 'server.example.com' }
34
+ its(:port) { should be_nil }
35
+ end
36
+ end
37
+
38
+ {
39
+ 'server.example.com:8080' => 'https://server.example.com:8080'
40
+ }.each do |input, output|
41
+ context "when '#{input}' is given" do
42
+ let(:identifier) { input }
43
+ its(:identifier) { should == output }
44
+ its(:host) { should == 'server.example.com' }
45
+ its(:port) { should == 8080 }
34
46
  end
35
47
  end
36
48
 
@@ -23,6 +23,19 @@ describe OpenIDConnect::Discovery::Principal do
23
23
  request
24
24
  end
25
25
 
26
+ context 'when port specified' do
27
+ it do
28
+ SWD.should_receive(:discover!).with(
29
+ :principal => "https://example.com:8080",
30
+ :service => "http://openid.net/specs/connect/1.0/issuer",
31
+ :host => "example.com",
32
+ :port => 8080,
33
+ :cache => {}
34
+ )
35
+ OpenIDConnect::Discovery::Principal.parse('example.com:8080').discover!
36
+ end
37
+ end
38
+
26
39
  context 'when discovery failed' do
27
40
  it do
28
41
  SWD.should_receive(:discover!).and_raise(SWD::Exception)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: