osso 0.0.3.2 → 0.0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Gemfile.lock +1 -1
- data/lib/osso/helpers/auth.rb +49 -51
- data/lib/osso/helpers/helpers.rb +1 -3
- data/lib/osso/routes/admin.rb +5 -1
- data/lib/osso/routes/oauth.rb +1 -2
- data/lib/osso/version.rb +1 -1
- data/spec/routes/admin_spec.rb +0 -1
- data/spec/spec_helper.rb +0 -4
- data/spec/support/vcr_cassettes/okta_saml_callback.yml +59 -0
- metadata +2 -23
- data/db/schema.rb +0 -1
- data/lib/osso/graphql/mutation.rb +0 -11
- data/lib/osso/graphql/mutations.rb +0 -9
- data/lib/osso/graphql/mutations/base_mutation.rb +0 -20
- data/lib/osso/graphql/mutations/configure_identity_provider.rb +0 -26
- data/lib/osso/graphql/mutations/create_identity_provider.rb +0 -24
- data/lib/osso/graphql/mutations/set_saml_provider.rb +0 -23
- data/lib/osso/graphql/query.rb +0 -28
- data/lib/osso/graphql/resolvers.rb +0 -8
- data/lib/osso/graphql/resolvers/enterprise_account.rb +0 -21
- data/lib/osso/graphql/resolvers/enterprise_accounts.rb +0 -13
- data/lib/osso/graphql/resolvers/oauth_clients.rb +0 -11
- data/lib/osso/graphql/schema.rb +0 -38
- data/lib/osso/graphql/types.rb +0 -12
- data/lib/osso/graphql/types/base_enum.rb +0 -6
- data/lib/osso/graphql/types/base_object.rb +0 -8
- data/lib/osso/graphql/types/enterprise_account.rb +0 -29
- data/lib/osso/graphql/types/identity_provider.rb +0 -36
- data/lib/osso/graphql/types/identity_provider_service.rb +0 -8
- data/lib/osso/graphql/types/oauth_client.rb +0 -16
- data/lib/osso/graphql/types/user.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b1788a4933cd6a5e4fef31d6e92c8c63cc9fd9e6cf6fb838b71f65161e9845b
|
4
|
+
data.tar.gz: 82508ceb2a7af276c64a6a1ae2ba3febc118e71d4c89fcb194db1d0ec35c686a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 363d13744052824deea9a26478549daac1dfd49d850577329f6c87efbe4f0de23d1aca40ee1aa39b8cd4324503267e5e81b192086532db796c122ca79e2a9c14
|
7
|
+
data.tar.gz: 9313221346428718b1d06b2ef10c9dcb453cd02716f4ccfaa956e956d19b420290c0818215cebba204aa843acb5a668dfdb6d11e285de1f3f847a786968c78a0
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/osso/helpers/auth.rb
CHANGED
@@ -1,69 +1,67 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
return if enterprise_authorized?(domain)
|
3
|
+
module Helpers
|
4
|
+
module Auth
|
5
|
+
attr_accessor :current_scope
|
6
|
+
|
7
|
+
def enterprise_protected!(domain = nil)
|
8
|
+
return if admin_authorized?
|
9
|
+
return if enterprise_authorized?(domain)
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def enterprise_authorized?(domain)
|
16
|
-
payload, _args = JWT.decode(
|
17
|
-
token,
|
18
|
-
ENV['JWT_HMAC_SECRET'],
|
19
|
-
true,
|
20
|
-
{ algorithm: 'HS256' },
|
21
|
-
)
|
11
|
+
redirect ENV['JWT_URL']
|
12
|
+
end
|
22
13
|
|
23
|
-
|
14
|
+
def enterprise_authorized?(domain)
|
15
|
+
payload, _args = JWT.decode(
|
16
|
+
token,
|
17
|
+
ENV['JWT_HMAC_SECRET'],
|
18
|
+
true,
|
19
|
+
{ algorithm: 'HS256' },
|
20
|
+
)
|
24
21
|
|
25
|
-
|
26
|
-
rescue JWT::DecodeError
|
27
|
-
false
|
28
|
-
end
|
22
|
+
@current_scope = payload['scope']
|
29
23
|
|
30
|
-
|
31
|
-
|
24
|
+
true
|
25
|
+
rescue JWT::DecodeError
|
26
|
+
false
|
27
|
+
end
|
32
28
|
|
33
|
-
|
34
|
-
|
29
|
+
def admin_protected!
|
30
|
+
return if admin_authorized?
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
token,
|
39
|
-
ENV['JWT_HMAC_SECRET'],
|
40
|
-
true,
|
41
|
-
{ algorithm: 'HS256' },
|
42
|
-
)
|
32
|
+
redirect ENV['JWT_URL']
|
33
|
+
end
|
43
34
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
35
|
+
def admin_authorized?
|
36
|
+
payload, _args = JWT.decode(
|
37
|
+
token,
|
38
|
+
ENV['JWT_HMAC_SECRET'],
|
39
|
+
true,
|
40
|
+
{ algorithm: 'HS256' },
|
41
|
+
)
|
48
42
|
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
if payload['scope'] == 'admin'
|
44
|
+
@current_scope = :admin
|
45
|
+
return true
|
52
46
|
end
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
false
|
49
|
+
rescue JWT::DecodeError
|
50
|
+
false
|
51
|
+
end
|
57
52
|
|
58
|
-
|
59
|
-
|
53
|
+
def token
|
54
|
+
request.env['admin_token'] || session['admin_token'] || request['admin_token']
|
55
|
+
end
|
60
56
|
|
61
|
-
|
57
|
+
def chomp_token
|
58
|
+
return unless request['admin_token'].present?
|
62
59
|
|
63
|
-
|
60
|
+
session['admin_token'] = request['admin_token']
|
64
61
|
|
65
|
-
|
66
|
-
|
62
|
+
return if request.post?
|
63
|
+
|
64
|
+
redirect request.path
|
67
65
|
end
|
68
66
|
end
|
69
|
-
end
|
67
|
+
end
|
data/lib/osso/helpers/helpers.rb
CHANGED
data/lib/osso/routes/admin.rb
CHANGED
@@ -14,7 +14,7 @@ module Osso
|
|
14
14
|
get '/' do
|
15
15
|
admin_protected!
|
16
16
|
|
17
|
-
erb :
|
17
|
+
erb :'public/index'
|
18
18
|
end
|
19
19
|
|
20
20
|
get '/enterprise' do
|
@@ -26,6 +26,10 @@ module Osso
|
|
26
26
|
get '/enterprise/:domain' do
|
27
27
|
enterprise_protected!(params[:domain])
|
28
28
|
|
29
|
+
@enterprise = Models::EnterpriseAccount.where(
|
30
|
+
domain: params[:domain],
|
31
|
+
).first_or_create
|
32
|
+
|
29
33
|
erb :admin
|
30
34
|
end
|
31
35
|
|
data/lib/osso/routes/oauth.rb
CHANGED
data/lib/osso/version.rb
CHANGED
data/spec/routes/admin_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:9292/auth/saml/:uuid/callback
|
6
|
+
body:
|
7
|
+
encoding: ASCII-8BIT
|
8
|
+
string: SAMLResponse=PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c2FtbDJwOlJlc3BvbnNlIERlc3RpbmF0aW9uPSJodHRwOi8vbG9jYWxob3N0OjkyOTIvYXV0aC9zYW1sLzY4ZTkwNTdjLTQ2MmYtNDM3Zi04NDRkLTk4NzI0ZmVmOWQ0My9jYWxsYmFjayIgSUQ9ImlkMTgyOTI5NzEwODgzMjU2OTIyMDE3Nzc0NDUyIiBJblJlc3BvbnNlVG89Il81NGM0ZjE5MS0xYmY3LTRiMDItOTZlYS0zNGQ4NTU1YWVjYWEiIElzc3VlSW5zdGFudD0iMjAyMC0wNC0xMVQxNjozMjoxOC40MjRaIiBWZXJzaW9uPSIyLjAiIHhtbG5zOnNhbWwycD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3RvY29sIiB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiPjxzYW1sMjpJc3N1ZXIgRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6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MS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTp0eXBlPSJ4czpzdHJpbmciPnNhbUB2Y2FyZG1lLmNvbTwvc2FtbDI6QXR0cmlidXRlVmFsdWU%2BPC9zYW1sMjpBdHRyaWJ1dGU%2BPHNhbWwyOkF0dHJpYnV0ZSBOYW1lPSJpZCIgTmFtZUZvcm1hdD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmF0dHJuYW1lLWZvcm1hdDp1bnNwZWNpZmllZCI%2BPHNhbWwyOkF0dHJpYnV0ZVZhbHVlIHhtbG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnR5cGU9InhzOnN0cmluZyI%2BMDB1NTEwd2pwNDRmdDNEUm80eDY8L3NhbWwyOkF0dHJpYnV0ZVZhbHVlPjwvc2FtbDI6QXR0cmlidXRlPjwvc2FtbDI6QXR0cmlidXRlU3RhdGVtZW50Pjwvc2FtbDI6QXNzZXJ0aW9uPjwvc2FtbDJwOlJlc3BvbnNlPg%3D%3D&RelayState=
|
9
|
+
headers:
|
10
|
+
Host:
|
11
|
+
- localhost:9292
|
12
|
+
Connection:
|
13
|
+
- keep-alive
|
14
|
+
Cache-Control:
|
15
|
+
- max-age=0
|
16
|
+
Upgrade-Insecure-Requests:
|
17
|
+
- '1'
|
18
|
+
Origin:
|
19
|
+
- 'null'
|
20
|
+
User-Agent:
|
21
|
+
- Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML,
|
22
|
+
like Gecko) Chrome/80.0.3987.163 Safari/537.36
|
23
|
+
Sec-Fetch-Dest:
|
24
|
+
- document
|
25
|
+
Accept:
|
26
|
+
- text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
|
27
|
+
Sec-Fetch-Site:
|
28
|
+
- cross-site
|
29
|
+
Sec-Fetch-Mode:
|
30
|
+
- navigate
|
31
|
+
Accept-Encoding:
|
32
|
+
- gzip, deflate, br
|
33
|
+
Accept-Language:
|
34
|
+
- en-US,en;q=0.9,fr;q=0.8
|
35
|
+
Cookie:
|
36
|
+
- _vcardme-api_session=YmdCdkxYdTlLWkhhWWNnZTQ5Yjdxc0gweWJjKys4TUtSWWVBd3c1U2tUT2E1b2t0MFQxd3lZQTJwSVcyZVFCOHZxaHRtTVZjVGYyay9ReVc0WElxR0hlVGM0MW5qQUxVZE8zYytTaXBlcDZraWRLSllkYjlvYUNMVkx6S3Aremh4ODB5eVBzMmFwS3dHOHNZaFFBYnJnPT0tLVRKUEdSMFV1SGRCZSt1LzNiYjRSZnc9PQ%3D%3D--4e212108b448172e97b0e205f75976780e843bd7;
|
37
|
+
mp_321622acf650be9cac3978565e73be1a_mixpanel=%7B%22distinct_id%22%3A%20%2217122c6e1421dd-0fd311181d4582-396f7f07-384000-17122c6e14935d%22%2C%22%24device_id%22%3A%20%2217122c6e1421dd-0fd311181d4582-396f7f07-384000-17122c6e14935d%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D;
|
38
|
+
rack.session=BAh7CUkiD3Nlc3Npb25faWQGOgZFVEkiRTdkYWNhMWRhNjc3MTY4OTY0ZWVj%0AZjg2YmIyOTM1M2EzOTcxZWIzN2ZjMzAxZGUxNmIyZGNiNDdhMGU0ZDdiMmQG%0AOwBGSSINc2FtbF91aWQGOwBUSSIUc2FtQHZjYXJkbWUuY29tBjsAVEkiF3Nh%0AbWxfc2Vzc2lvbl9pbmRleAY7AFRJIipfOTBjYjc4NjItYTc5My00M2ZjLWFh%0AOWItZDdiMjY0ZWE4NmM2BjsAVEkiFG9tbmlhdXRoLnBhcmFtcwY7AFR7AA%3D%3D%0A--429d063c69188264011d1384cbf24a4b486d2d3a
|
39
|
+
Version:
|
40
|
+
- HTTP/1.1
|
41
|
+
Content-Type:
|
42
|
+
- application/x-www-form-urlencoded
|
43
|
+
Content-Length:
|
44
|
+
- '10749'
|
45
|
+
response:
|
46
|
+
status:
|
47
|
+
code: 200
|
48
|
+
message: null
|
49
|
+
headers:
|
50
|
+
Content-Type:
|
51
|
+
- application/json
|
52
|
+
Content-Length:
|
53
|
+
- '112'
|
54
|
+
body:
|
55
|
+
encoding: UTF-8
|
56
|
+
string: '{"user":{"id":"2077ee4f-9e7d-46c2-bbf3-98c49c312281","email":"sam@vcardme.com","idp_id":"00u510wjp44ft3DRo4x6"}}'
|
57
|
+
http_version: null
|
58
|
+
recorded_at: Sat, 11 Apr 2020 16:32:18 GMT
|
59
|
+
recorded_with: VCR 5.1.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.3.
|
4
|
+
version: 0.0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Bauch
|
@@ -218,7 +218,6 @@ files:
|
|
218
218
|
- bin/console
|
219
219
|
- bin/setup
|
220
220
|
- config/database.yml
|
221
|
-
- db/schema.rb
|
222
221
|
- lib/.DS_Store
|
223
222
|
- lib/osso.rb
|
224
223
|
- lib/osso/Rakefile
|
@@ -238,27 +237,6 @@ files:
|
|
238
237
|
- lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_account.rb
|
239
238
|
- lib/osso/db/migrate/20200601131227_drop_null_constraint_from_saml_providers_provider.rb
|
240
239
|
- lib/osso/db/schema.rb
|
241
|
-
- lib/osso/graphql/.DS_Store
|
242
|
-
- lib/osso/graphql/mutation.rb
|
243
|
-
- lib/osso/graphql/mutations.rb
|
244
|
-
- lib/osso/graphql/mutations/base_mutation.rb
|
245
|
-
- lib/osso/graphql/mutations/configure_identity_provider.rb
|
246
|
-
- lib/osso/graphql/mutations/create_identity_provider.rb
|
247
|
-
- lib/osso/graphql/mutations/set_saml_provider.rb
|
248
|
-
- lib/osso/graphql/query.rb
|
249
|
-
- lib/osso/graphql/resolvers.rb
|
250
|
-
- lib/osso/graphql/resolvers/enterprise_account.rb
|
251
|
-
- lib/osso/graphql/resolvers/enterprise_accounts.rb
|
252
|
-
- lib/osso/graphql/resolvers/oauth_clients.rb
|
253
|
-
- lib/osso/graphql/schema.rb
|
254
|
-
- lib/osso/graphql/types.rb
|
255
|
-
- lib/osso/graphql/types/base_enum.rb
|
256
|
-
- lib/osso/graphql/types/base_object.rb
|
257
|
-
- lib/osso/graphql/types/enterprise_account.rb
|
258
|
-
- lib/osso/graphql/types/identity_provider.rb
|
259
|
-
- lib/osso/graphql/types/identity_provider_service.rb
|
260
|
-
- lib/osso/graphql/types/oauth_client.rb
|
261
|
-
- lib/osso/graphql/types/user.rb
|
262
240
|
- lib/osso/helpers/auth.rb
|
263
241
|
- lib/osso/helpers/helpers.rb
|
264
242
|
- lib/osso/lib/app_config.rb
|
@@ -297,6 +275,7 @@ files:
|
|
297
275
|
- spec/routes/auth_spec.rb
|
298
276
|
- spec/routes/oauth_spec.rb
|
299
277
|
- spec/spec_helper.rb
|
278
|
+
- spec/support/vcr_cassettes/okta_saml_callback.yml
|
300
279
|
homepage: https://github.com/enterprise-oss/osso-rb
|
301
280
|
licenses:
|
302
281
|
- MIT
|
data/db/schema.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'mutations'
|
4
|
-
|
5
|
-
module Types
|
6
|
-
class MutationType < BaseObject
|
7
|
-
field :configure_identity_provider, mutation: Mutations::ConfigureIdentityProvider
|
8
|
-
field :create_identity_provider, mutation: Mutations::CreateIdentityProvider
|
9
|
-
field :set_saml_provider, mutation: Mutations::SetSamlProvider
|
10
|
-
end
|
11
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutations
|
4
|
-
end
|
5
|
-
|
6
|
-
require_relative 'mutations/base_mutation'
|
7
|
-
require_relative 'mutations/configure_identity_provider'
|
8
|
-
require_relative 'mutations/create_identity_provider'
|
9
|
-
require_relative 'mutations/set_saml_provider'
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutations
|
4
|
-
class BaseMutation < GraphQL::Schema::RelayClassicMutation
|
5
|
-
# This is used for generating payload types
|
6
|
-
object_class Types::BaseObject
|
7
|
-
# # This is used for return fields on the mutation's payload
|
8
|
-
# field_class Types::BaseField
|
9
|
-
# # This is used for generating the `input: { ... }` object type
|
10
|
-
# input_object_class Types::BaseInputObject
|
11
|
-
|
12
|
-
def return_data(data)
|
13
|
-
data.merge(errors: [])
|
14
|
-
end
|
15
|
-
|
16
|
-
def return_error(error)
|
17
|
-
error.merge(data: nil)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutations
|
4
|
-
class ConfigureIdentityProvider < BaseMutation
|
5
|
-
null false
|
6
|
-
argument :id, ID, required: true
|
7
|
-
# argument :provider, Types::IdentityProviderService, required: true
|
8
|
-
argument :sso_url, String, required: true
|
9
|
-
argument :sso_cert, String, required: true
|
10
|
-
|
11
|
-
field :identity_provider, Types::IdentityProvider, null: true
|
12
|
-
field :errors, [String], null: false
|
13
|
-
|
14
|
-
def resolve(id:, sso_url:, sso_cert:)
|
15
|
-
provider = Osso::Models::SamlProvider.find(id)
|
16
|
-
provider.update(
|
17
|
-
idp_cert: sso_cert,
|
18
|
-
idp_sso_target_url: sso_url,
|
19
|
-
)
|
20
|
-
|
21
|
-
return_data(identity_provider: provider)
|
22
|
-
# rescue StandardError => e
|
23
|
-
# return_error(errors: e.full_message)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutations
|
4
|
-
class CreateIdentityProvider < BaseMutation
|
5
|
-
null false
|
6
|
-
argument :enterprise_account_id, ID, required: true
|
7
|
-
argument :provider_service, Types::IdentityProviderService, required: true
|
8
|
-
|
9
|
-
field :identity_provider, Types::IdentityProvider, null: false
|
10
|
-
field :errors, [String], null: false
|
11
|
-
|
12
|
-
def resolve(enterprise_account_id:, provider_service:)
|
13
|
-
enterprise_account = Osso::Models::EnterpriseAccount.find(enterprise_account_id)
|
14
|
-
identity_provider = enterprise_account.saml_providers.create!(
|
15
|
-
provider: provider_service || 'OKTA',
|
16
|
-
domain: enterprise_account.domain,
|
17
|
-
)
|
18
|
-
|
19
|
-
return_data(identity_provider: identity_provider)
|
20
|
-
rescue StandardError => e
|
21
|
-
return_error(errors: e.full_message)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutations
|
4
|
-
class SetSamlProvider < BaseMutation
|
5
|
-
null false
|
6
|
-
|
7
|
-
argument :provider, Types::IdentityProviderService, required: true
|
8
|
-
argument :id, ID, required: true
|
9
|
-
|
10
|
-
field :identity_provider, Types::IdentityProvider, null: false
|
11
|
-
field :errors, [String], null: false
|
12
|
-
|
13
|
-
def resolve(provider:, id:)
|
14
|
-
saml_provider = Osso::Models::SamlProvider.find(id)
|
15
|
-
saml_provider.provider = provider
|
16
|
-
saml_provider.save!
|
17
|
-
{
|
18
|
-
saml_provider: saml_provider,
|
19
|
-
errors: [],
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/osso/graphql/query.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Types
|
4
|
-
class QueryType < GraphQL::Schema::Object
|
5
|
-
# field :node, field: GraphQL::Relay::Node.field
|
6
|
-
field :enterprise_account, null: false, resolver: Resolvers::EnterpriseAccount do
|
7
|
-
argument :domain, String, required: true
|
8
|
-
end
|
9
|
-
field :enterprise_accounts, null: true, resolver: Resolvers::EnterpriseAccounts
|
10
|
-
field :oauth_clients, null: true, resolver: Resolvers::OAuthClients
|
11
|
-
|
12
|
-
field(
|
13
|
-
:identity_provider,
|
14
|
-
Types::IdentityProvider,
|
15
|
-
null: true,
|
16
|
-
resolve: ->(_obj, args, _context) { Osso::Models::SamlProvider.find(args[:id]) },
|
17
|
-
) do
|
18
|
-
argument :id, ID, required: true
|
19
|
-
end
|
20
|
-
|
21
|
-
# field(
|
22
|
-
# :viewer,
|
23
|
-
# Types::User,
|
24
|
-
# null: true,
|
25
|
-
# resolve: ->(_obj, _args, context) { context[:current_user] },
|
26
|
-
# )
|
27
|
-
end
|
28
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Resolvers
|
4
|
-
class EnterpriseAccount < GraphQL::Schema::Resolver
|
5
|
-
type Types::EnterpriseAccount, null: false
|
6
|
-
|
7
|
-
def resolve(args)
|
8
|
-
return unless admin? || enterprise_authorized?(args[:domain])
|
9
|
-
|
10
|
-
Osso::Models::EnterpriseAccount.find_by(domain: args[:domain])
|
11
|
-
end
|
12
|
-
|
13
|
-
def admin?
|
14
|
-
context[:scope] == :admin
|
15
|
-
end
|
16
|
-
|
17
|
-
def enterprise_authorized?(domain)
|
18
|
-
context[:scope] == domain
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Resolvers
|
4
|
-
class EnterpriseAccounts < GraphQL::Schema::Resolver
|
5
|
-
type [Types::EnterpriseAccount], null: true
|
6
|
-
|
7
|
-
def resolve
|
8
|
-
return Osso::Models::EnterpriseAccount.all if context[:scope] == :admin
|
9
|
-
|
10
|
-
Array(Osso::Models::EnterpriseAccount.find_by(domain: context[:scope]))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/lib/osso/graphql/schema.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'graphql'
|
4
|
-
require_relative 'types'
|
5
|
-
require_relative 'resolvers'
|
6
|
-
require_relative 'mutation'
|
7
|
-
require_relative 'query'
|
8
|
-
|
9
|
-
GraphQL::Relay::BaseConnection.register_connection_implementation(
|
10
|
-
ActiveRecord::Relation,
|
11
|
-
GraphQL::Relay::RelationConnection,
|
12
|
-
)
|
13
|
-
|
14
|
-
class OssoSchema < GraphQL::Schema
|
15
|
-
query Types::QueryType
|
16
|
-
mutation Types::MutationType
|
17
|
-
use GraphQL::Pagination::Connections
|
18
|
-
|
19
|
-
def self.id_from_object(object, _type_definition = nil, _query_ctx = nil)
|
20
|
-
GraphQL::Schema::UniqueWithinType.encode(object.class.name, object.id)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.object_from_id(id, _query_ctx = nil)
|
24
|
-
class_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
|
25
|
-
Object.const_get(class_name).find(item_id)
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.resolve_type(_type, obj, _ctx)
|
29
|
-
case obj
|
30
|
-
when Osso::Models::EnterpriseAccount
|
31
|
-
Types::EnterpriseAccount
|
32
|
-
when Osso::Models::SamlProvider
|
33
|
-
Types::IdentityProvider
|
34
|
-
else
|
35
|
-
raise("Unexpected object: #{obj}")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/osso/graphql/types.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Types
|
4
|
-
end
|
5
|
-
|
6
|
-
require_relative 'types/base_object'
|
7
|
-
require_relative 'types/base_enum'
|
8
|
-
require_relative 'types/identity_provider_service'
|
9
|
-
require_relative 'types/identity_provider'
|
10
|
-
require_relative 'types/enterprise_account'
|
11
|
-
require_relative 'types/oauth_client'
|
12
|
-
require_relative 'types/user'
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'graphql'
|
4
|
-
|
5
|
-
module Types
|
6
|
-
class EnterpriseAccount < Types::BaseObject
|
7
|
-
description 'An Account for a company that wishes to use SAML via Osso'
|
8
|
-
implements GraphQL::Types::Relay::Node
|
9
|
-
|
10
|
-
global_id_field :gid
|
11
|
-
field :id, ID, null: false
|
12
|
-
field :name, String, null: false
|
13
|
-
field :domain, String, null: false
|
14
|
-
field :identity_providers, [Types::IdentityProvider], null: true
|
15
|
-
field :status, String, null: false
|
16
|
-
|
17
|
-
def name
|
18
|
-
object.domain.gsub('.com', '')
|
19
|
-
end
|
20
|
-
|
21
|
-
def status
|
22
|
-
'active'
|
23
|
-
end
|
24
|
-
|
25
|
-
def identity_providers
|
26
|
-
object.saml_providers
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'graphql'
|
4
|
-
|
5
|
-
module Types
|
6
|
-
class IdentityProvider < Types::BaseObject
|
7
|
-
description 'Represents a SAML based IDP instance for an EnterpriseAccount'
|
8
|
-
implements GraphQL::Types::Relay::Node
|
9
|
-
|
10
|
-
global_id_field :gid
|
11
|
-
field :id, ID, null: false
|
12
|
-
field :enterprise_Account_id, ID, null: false
|
13
|
-
field :service, Types::IdentityProviderService, null: true
|
14
|
-
field :domain, String, null: false
|
15
|
-
field :acs_url, String, null: false
|
16
|
-
field :sso_url, String, null: true
|
17
|
-
field :sso_cert, String, null: true
|
18
|
-
field :configured, Boolean, null: false
|
19
|
-
|
20
|
-
def service
|
21
|
-
@object.provider
|
22
|
-
end
|
23
|
-
|
24
|
-
def configured
|
25
|
-
@object.idp_sso_target_url && @object.idp_cert
|
26
|
-
end
|
27
|
-
|
28
|
-
def sso_cert
|
29
|
-
@object.idp_cert
|
30
|
-
end
|
31
|
-
|
32
|
-
def sso_url
|
33
|
-
@object.idp_sso_target_url
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Types
|
4
|
-
class IdentityProviderService < BaseEnum
|
5
|
-
value('AZURE', 'Microsoft Azure Identity Provider', value: 'Osso::Models::AzureSamlProvider')
|
6
|
-
value('OKTA', 'Okta Identity Provider', value: 'Osso::Models::OktaSamlProvider')
|
7
|
-
end
|
8
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'graphql'
|
4
|
-
|
5
|
-
module Types
|
6
|
-
class OAuthClient < Types::BaseObject
|
7
|
-
description 'An OAuth client used to consume Osso SAML users'
|
8
|
-
implements GraphQL::Types::Relay::Node
|
9
|
-
|
10
|
-
global_id_field :gid
|
11
|
-
field :id, ID, null: false
|
12
|
-
field :name, String, null: false
|
13
|
-
field :client_id, String, null: false
|
14
|
-
field :client_secret, String, null: false
|
15
|
-
end
|
16
|
-
end
|