osso 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3557c5b1128c7a026fa1ddb14cb570b6d247231f3dc7ef22c4ef60af427ec3a2
4
- data.tar.gz: fa59daf216455edc141fc1c1dd20b965cb90122dfa7e0e30ad3d3fc46a348951
3
+ metadata.gz: e32f4645ca2763467c9558a6bf103cc5695de99b191e0e2a763e9d1be189e984
4
+ data.tar.gz: ca9c4d902553eee5132fc41c98a458441b20c6aa645bc8a33b48601c80e83392
5
5
  SHA512:
6
- metadata.gz: 4089820668fa27aa45e7dbb92bf58713202657ec71e6bb2ca24d79b19176e9e444f9c114119489c08417909b7b6403c7e3a1342bf4caa3174d0d5dca77d822f3
7
- data.tar.gz: 41f3deba4a448aa35c03cf5630b1eeb9784fa200b5bdd020a2c5e29d4b8f8df95da1af0d6dea942d71cdfff2c691948412053a834fd249f8e4b66116e4d025f5
6
+ metadata.gz: 1c58936f2fa400fb36955405512522bb1fb25ca3c6d8c3436b157d7d915e4db662070b93e1f6f6c7cb523d6f90043426b7bb8b6320967e09aac3be536587c840
7
+ data.tar.gz: '0359da56b5e70537d496a770d6f4e90a1ec248bc786e48b7a7f13dd3860729cb5d1a76de43a9666a486ad4727f3c032c22bdf0a4c0257ee3416d5d41164295c3'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- osso (0.0.7)
4
+ osso (0.0.8)
5
5
  activesupport (>= 6.0.3.2)
6
6
  bcrypt (~> 3.1.13)
7
7
  graphql
@@ -23,17 +23,17 @@ PATH
23
23
  GEM
24
24
  remote: https://rubygems.org/
25
25
  specs:
26
- activemodel (6.0.3.4)
27
- activesupport (= 6.0.3.4)
28
- activerecord (6.0.3.4)
29
- activemodel (= 6.0.3.4)
30
- activesupport (= 6.0.3.4)
31
- activesupport (6.0.3.4)
26
+ activemodel (6.1.0)
27
+ activesupport (= 6.1.0)
28
+ activerecord (6.1.0)
29
+ activemodel (= 6.1.0)
30
+ activesupport (= 6.1.0)
31
+ activesupport (6.1.0)
32
32
  concurrent-ruby (~> 1.0, >= 1.0.2)
33
- i18n (>= 0.7, < 2)
34
- minitest (~> 5.1)
35
- tzinfo (~> 1.1)
36
- zeitwerk (~> 2.2, >= 2.2.2)
33
+ i18n (>= 1.6, < 2)
34
+ minitest (>= 5.1)
35
+ tzinfo (~> 2.0)
36
+ zeitwerk (~> 2.3)
37
37
  addressable (2.7.0)
38
38
  public_suffix (>= 2.0.2, < 5.0)
39
39
  aes_key_wrap (1.1.0)
@@ -133,7 +133,7 @@ GEM
133
133
  diff-lcs (>= 1.2.0, < 2.0)
134
134
  rspec-support (~> 3.10.0)
135
135
  rspec-support (3.10.0)
136
- rubocop (1.5.2)
136
+ rubocop (1.6.1)
137
137
  parallel (~> 1.10)
138
138
  parser (>= 2.7.1.5)
139
139
  rainbow (>= 2.2.2, < 4.0)
@@ -172,16 +172,15 @@ GEM
172
172
  rack-protection (= 2.1.0)
173
173
  sinatra (= 2.1.0)
174
174
  tilt (~> 2.0)
175
- thread_safe (0.3.6)
176
175
  tilt (2.0.10)
177
- tzinfo (1.2.8)
178
- thread_safe (~> 0.1)
176
+ tzinfo (2.0.3)
177
+ concurrent-ruby (~> 1.0)
179
178
  unicode-display_width (1.7.0)
180
179
  webmock (3.10.0)
181
180
  addressable (>= 2.3.6)
182
181
  crack (>= 0.3.2)
183
182
  hashdiff (>= 0.4.0, < 2.0.0)
184
- zeitwerk (2.4.1)
183
+ zeitwerk (2.4.2)
185
184
 
186
185
  PLATFORMS
187
186
  ruby
@@ -30,6 +30,7 @@ module Osso
30
30
  idp_sso_target_url: sso_url,
31
31
  idp_cert: sso_cert,
32
32
  issuer: sso_issuer,
33
+ name_identifier_format: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
33
34
  }
34
35
  end
35
36
 
@@ -16,13 +16,14 @@ module Osso
16
16
  # Once they complete IdP login, they will be returned to the
17
17
  # redirect_uri with an authorization code parameter.
18
18
  get '/authorize' do
19
- identity_providers = find_providers
20
-
21
19
  validate_oauth_request(env)
22
20
 
23
- redirect "/auth/saml/#{identity_providers.first.id}" if identity_providers.one?
21
+ return erb :hosted_login if render_hosted_login?
22
+
23
+ @providers = find_providers
24
+
25
+ redirect "/auth/saml/#{@providers.first.id}" if @providers.one?
24
26
 
25
- @providers = identity_providers.not_pending
26
27
  return erb :multiple_providers if @providers.count > 1
27
28
 
28
29
  raise Osso::Error::MissingConfiguredIdentityProvider.new(domain: params[:domain])
@@ -61,6 +62,10 @@ module Osso
61
62
 
62
63
  private
63
64
 
65
+ def render_hosted_login?
66
+ [params[:email], params[:domain]].all?(&:nil?)
67
+ end
68
+
64
69
  def find_providers
65
70
  if params[:email]
66
71
  user = Osso::Models::User.
@@ -71,6 +76,7 @@ module Osso
71
76
 
72
77
  Osso::Models::IdentityProvider.
73
78
  joins(:oauth_client).
79
+ not_pending.
74
80
  where(
75
81
  domain: domain_from_params,
76
82
  oauth_clients: { identifier: params[:client_id] },
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Osso
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
  end
@@ -66,6 +66,7 @@ describe Osso::Models::IdentityProvider do
66
66
  idp_cert: subject.sso_cert,
67
67
  idp_sso_target_url: subject.sso_url,
68
68
  issuer: subject.sso_issuer,
69
+ name_identifier_format: "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
69
70
  )
70
71
  end
71
72
  end
@@ -27,6 +27,20 @@ describe Osso::Oauth do
27
27
  end
28
28
  end
29
29
 
30
+ describe 'for a request without email or domain' do
31
+ it 'redirects to /auth/saml/:provider_id' do
32
+ get(
33
+ '/oauth/authorize',
34
+ client_id: client.identifier,
35
+ response_type: 'code',
36
+ redirect_uri: client.redirect_uri_values.sample,
37
+ )
38
+
39
+ expect(last_response).to be_ok
40
+ expect(last_response.body).to eq('HOSTED LOGIN')
41
+ end
42
+ end
43
+
30
44
  describe 'for an enterprise domain with one SAML provider' do
31
45
  it 'redirects to /auth/saml/:provider_id' do
32
46
  enterprise = create(:enterprise_with_okta, oauth_client: client)
@@ -0,0 +1 @@
1
+ HOSTED LOGIN
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Bauch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-08 00:00:00.000000000 Z
11
+ date: 2020-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -463,6 +463,7 @@ files:
463
463
  - spec/support/spec_app.rb
464
464
  - spec/support/views/admin.erb
465
465
  - spec/support/views/error.erb
466
+ - spec/support/views/hosted_login.erb
466
467
  - spec/support/views/layout.erb
467
468
  - spec/support/views/multiple_providers.erb
468
469
  homepage: https://github.com/enterprise-oss/osso-rb