osso 0.0.7 → 0.0.8
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 +4 -4
- data/Gemfile.lock +15 -16
- data/lib/osso/models/identity_provider.rb +1 -0
- data/lib/osso/routes/oauth.rb +10 -4
- data/lib/osso/version.rb +1 -1
- data/spec/models/identity_provider_spec.rb +1 -0
- data/spec/routes/oauth_spec.rb +14 -0
- data/spec/support/views/hosted_login.erb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e32f4645ca2763467c9558a6bf103cc5695de99b191e0e2a763e9d1be189e984
|
|
4
|
+
data.tar.gz: ca9c4d902553eee5132fc41c98a458441b20c6aa645bc8a33b48601c80e83392
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c58936f2fa400fb36955405512522bb1fb25ca3c6d8c3436b157d7d915e4db662070b93e1f6f6c7cb523d6f90043426b7bb8b6320967e09aac3be536587c840
|
|
7
|
+
data.tar.gz: '0359da56b5e70537d496a770d6f4e90a1ec248bc786e48b7a7f13dd3860729cb5d1a76de43a9666a486ad4727f3c032c22bdf0a4c0257ee3416d5d41164295c3'
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
osso (0.0.
|
|
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
|
|
27
|
-
activesupport (= 6.0
|
|
28
|
-
activerecord (6.0
|
|
29
|
-
activemodel (= 6.0
|
|
30
|
-
activesupport (= 6.0
|
|
31
|
-
activesupport (6.0
|
|
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 (>=
|
|
34
|
-
minitest (
|
|
35
|
-
tzinfo (~>
|
|
36
|
-
zeitwerk (~> 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.
|
|
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 (
|
|
178
|
-
|
|
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.
|
|
183
|
+
zeitwerk (2.4.2)
|
|
185
184
|
|
|
186
185
|
PLATFORMS
|
|
187
186
|
ruby
|
data/lib/osso/routes/oauth.rb
CHANGED
|
@@ -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
|
-
|
|
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] },
|
data/lib/osso/version.rb
CHANGED
data/spec/routes/oauth_spec.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
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
|