osso 0.1.0 → 0.1.1
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 +3 -5
- data/lib/osso/routes/admin.rb +10 -0
- data/lib/osso/version.rb +1 -1
- data/spec/routes/admin_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8304c085cb599d56e9da71e5b30d8eec9096bf51f026f5f1bd2ac328b71600d7
|
4
|
+
data.tar.gz: e1d36cd4b70b19d7952c1d0e6f196c8bb608ca9b9431bdf376cacd632797d5d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f24f85bff86b6728a42cac1a421e8a93a2c1b3d529a668bf6935698b0d509733626677d4922febc45b6fcb88690e6a67f86c49ce69e9ed37d6e026da72a3543
|
7
|
+
data.tar.gz: 52a7d82d04e5073502c06e83b6a42bf31036a083e210f0683ce9d115ad88dbd97cf09e246a85b2d31a7cd419a8ca6b5460113a22d44e39130134cacf3cfff458
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
osso (0.1.
|
4
|
+
osso (0.1.1)
|
5
5
|
activesupport (>= 6.0.3.2)
|
6
6
|
bcrypt (~> 3.1.13)
|
7
7
|
graphql
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
activesupport (>= 5.0.0)
|
63
63
|
faker (2.15.1)
|
64
64
|
i18n (>= 1.6, < 2)
|
65
|
-
graphql (1.12.
|
65
|
+
graphql (1.12.3)
|
66
66
|
hashdiff (1.0.1)
|
67
67
|
hashie (4.1.0)
|
68
68
|
httpclient (2.8.3)
|
@@ -77,13 +77,11 @@ GEM
|
|
77
77
|
mini_mime (>= 0.1.1)
|
78
78
|
method_source (1.0.0)
|
79
79
|
mini_mime (1.0.2)
|
80
|
-
mini_portile2 (2.5.0)
|
81
80
|
minitest (5.14.3)
|
82
81
|
multi_json (1.15.0)
|
83
82
|
mustermann (1.1.1)
|
84
83
|
ruby2_keywords (~> 0.0.1)
|
85
|
-
nokogiri (1.11.1)
|
86
|
-
mini_portile2 (~> 2.5.0)
|
84
|
+
nokogiri (1.11.1-x86_64-darwin)
|
87
85
|
racc (~> 1.4)
|
88
86
|
omniauth (2.0.1)
|
89
87
|
hashie (>= 3.4.6)
|
data/lib/osso/routes/admin.rb
CHANGED
@@ -11,6 +11,7 @@ module Osso
|
|
11
11
|
use Rack::Session::Cookie, secret: ENV.fetch('SESSION_SECRET')
|
12
12
|
|
13
13
|
plugin :json
|
14
|
+
plugin :json_parser
|
14
15
|
plugin :middleware
|
15
16
|
plugin :render, engine: 'erb', views: ENV['RODAUTH_VIEWS'] || DEFAULT_VIEWS_DIR
|
16
17
|
plugin :route_csrf
|
@@ -73,6 +74,15 @@ module Osso
|
|
73
74
|
erb :admin, layout: false
|
74
75
|
end
|
75
76
|
|
77
|
+
r.post 'idp' do
|
78
|
+
onboarded = Osso::Models::IdentityProvider.
|
79
|
+
not_pending.
|
80
|
+
where(domain: r.params['domain']).
|
81
|
+
exists?
|
82
|
+
|
83
|
+
{ onboarded: onboarded }.to_json
|
84
|
+
end
|
85
|
+
|
76
86
|
r.post 'graphql' do
|
77
87
|
rodauth.require_authentication
|
78
88
|
|
data/lib/osso/version.rb
CHANGED
data/spec/routes/admin_spec.rb
CHANGED
@@ -41,4 +41,31 @@ describe Osso::Admin do
|
|
41
41
|
expect(last_response.status).to eq 401
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe 'post /idp' do
|
46
|
+
let(:domain) { Faker::Internet.domain_name }
|
47
|
+
|
48
|
+
before do
|
49
|
+
create(:configured_identity_provider, domain: domain)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'returns true when an available IDP is found' do
|
53
|
+
header 'Content-Type', 'application/json'
|
54
|
+
header 'Accept', 'application/json'
|
55
|
+
post('/idp', { domain: domain }.to_json)
|
56
|
+
|
57
|
+
expect(last_response).to be_ok
|
58
|
+
expect(last_json_response).to eq({ onboarded: true })
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'returns false when an available IDP is not found' do
|
62
|
+
header 'Content-Type', 'application/json'
|
63
|
+
header 'Accept', 'application/json'
|
64
|
+
|
65
|
+
post('/idp', { domain: domain.reverse}.to_json)
|
66
|
+
|
67
|
+
expect(last_response).to be_ok
|
68
|
+
expect(last_json_response).to eq({ onboarded: false })
|
69
|
+
end
|
70
|
+
end
|
44
71
|
end
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Bauch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|