osso 0.0.3 → 0.0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/pipeline.yml +1 -1
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +1 -2
  5. data/Gemfile.lock +3 -1
  6. data/bin/console +4 -3
  7. data/db/schema.rb +1 -0
  8. data/lib/osso.rb +2 -0
  9. data/lib/osso/graphql/mutation.rb +15 -0
  10. data/lib/osso/graphql/mutations.rb +11 -0
  11. data/lib/osso/graphql/mutations/base_mutation.rb +24 -0
  12. data/lib/osso/graphql/mutations/configure_identity_provider.rb +30 -0
  13. data/lib/osso/graphql/mutations/create_identity_provider.rb +28 -0
  14. data/lib/osso/graphql/mutations/set_saml_provider.rb +27 -0
  15. data/lib/osso/graphql/query.rb +25 -0
  16. data/lib/osso/graphql/resolvers.rb +12 -0
  17. data/lib/osso/graphql/resolvers/enterprise_account.rb +25 -0
  18. data/lib/osso/graphql/resolvers/enterprise_accounts.rb +17 -0
  19. data/lib/osso/graphql/resolvers/oauth_clients.rb +15 -0
  20. data/lib/osso/graphql/schema.rb +42 -0
  21. data/lib/osso/graphql/types.rb +14 -0
  22. data/lib/osso/graphql/types/base_enum.rb +10 -0
  23. data/lib/osso/graphql/types/base_object.rb +12 -0
  24. data/lib/osso/graphql/types/enterprise_account.rb +33 -0
  25. data/lib/osso/graphql/types/identity_provider.rb +40 -0
  26. data/lib/osso/graphql/types/identity_provider_service.rb +12 -0
  27. data/lib/osso/graphql/types/oauth_client.rb +20 -0
  28. data/lib/osso/graphql/types/user.rb +17 -0
  29. data/lib/osso/helpers/auth.rb +53 -49
  30. data/lib/osso/helpers/helpers.rb +3 -1
  31. data/lib/osso/lib/route_map.rb +28 -0
  32. data/lib/osso/models/oauth_client.rb +1 -1
  33. data/lib/osso/models/saml_providers/azure_saml_provider.rb +1 -1
  34. data/lib/osso/routes/admin.rb +18 -19
  35. data/lib/osso/routes/auth.rb +28 -25
  36. data/lib/osso/routes/oauth.rb +50 -44
  37. data/lib/osso/version.rb +1 -1
  38. data/osso-rb.gemspec +3 -3
  39. data/spec/routes/admin_spec.rb +3 -0
  40. data/spec/spec_helper.rb +7 -5
  41. data/spec/support/spec_app.rb +9 -0
  42. data/spec/support/views/admin.erb +5 -0
  43. metadata +41 -3
  44. data/spec/support/vcr_cassettes/okta_saml_callback.yml +0 -59
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4d6c8de140e9aee1afb784383da381c1fe16eb9816eb1ed0d6439a851e5aef2
4
- data.tar.gz: e393a2c08eb2c64f9f151b06174aaf45b9d980081d3bc3a792984cf6e64f3b5f
3
+ metadata.gz: abe7c30a149dfc3e0b0c457317b07065503bb551e1b93bd9e2a98443460eb426
4
+ data.tar.gz: 41b7772e2a15c6507104b3ceb4922db9b72f9071ac5d0763bb51334bce324a83
5
5
  SHA512:
6
- metadata.gz: 331e8828f50de204268d11922a5dc6973b65bb03ba214e7f354f95713e75eb41143554fbbf42903daced8e9bec8bbfd19824e2866673f3a27c6348a62da40992
7
- data.tar.gz: 42c3392315313792aa4012a582c395e7b304af4dfb720d0ebbbaa9407841b58924f910bcc963ff10a710f31e1a955f6643edfcb5894a2fe1c04e4d22f9a47dcb
6
+ metadata.gz: 90647d30bd113058d75d2e958ac6f116fa26a5e1262460795adbeb438e99dc3fe93ab57610dd705c1ca07a3daf7fb52eba1f651e47979fbc8494ca159cfe8712
7
+ data.tar.gz: 7922ea24bdfff89d21e3f615e8decc4b88c6f672512f5fb04405061c09a178bbe6ab10addec9cd75969e1cec774441d235715c8b4ab631da7bb42a3bd25d8027
@@ -1,3 +1,3 @@
1
1
  steps:
2
2
  - name: ":rspec:"
3
- command: "bundle install --path vendor/bundle --with development test && RACK_ENV=test bundle exec rake db:migrate && bundle exec rspec"
3
+ command: "bundle install --path vendor/bundle --with development test && RACK_ENV=test bundle exec rake db:migrate && bundle exec rspec"
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  *.gem
10
+ .DS_Store
@@ -1,8 +1,7 @@
1
1
  AllCops:
2
2
  Exclude:
3
- - client/**/*
4
3
  - db/**/*
5
- - node_modules/**/*
4
+ - lib/osso/db/**/*
6
5
 
7
6
  # New rules must be explicitly opted into / out of
8
7
  Lint/RaiseException:
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- osso (0.0.3)
4
+ osso (0.0.3.5)
5
5
  activesupport (>= 6.0.3.2)
6
+ graphql
6
7
  jwt
7
8
  omniauth-multi-provider
8
9
  omniauth-saml
@@ -48,6 +49,7 @@ GEM
48
49
  activesupport (>= 5.0.0)
49
50
  faker (2.13.0)
50
51
  i18n (>= 1.6, < 2)
52
+ graphql (1.11.1)
51
53
  hashdiff (1.0.1)
52
54
  hashie (4.1.0)
53
55
  httpclient (2.8.3)
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "osso"
4
+ require 'bundler/setup'
5
+ require 'osso'
5
6
 
6
- require "irb"
7
+ require 'irb'
7
8
  IRB.start(__FILE__)
@@ -0,0 +1 @@
1
+ # frozen_string_literal: true
@@ -4,6 +4,8 @@ module Osso
4
4
  require_relative 'osso/helpers/helpers'
5
5
  require_relative 'osso/lib/app_config'
6
6
  require_relative 'osso/lib/oauth2_token'
7
+ require_relative 'osso/lib/route_map'
7
8
  require_relative 'osso/models/models'
8
9
  require_relative 'osso/routes/routes'
10
+ require_relative 'osso/graphql/schema'
9
11
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'mutations'
4
+
5
+ module Osso
6
+ module GraphQL
7
+ module Types
8
+ class MutationType < BaseObject
9
+ field :configure_identity_provider, mutation: Mutations::ConfigureIdentityProvider
10
+ field :create_identity_provider, mutation: Mutations::CreateIdentityProvider
11
+ field :set_saml_provider, mutation: Mutations::SetSamlProvider
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module Mutations
5
+ end
6
+ end
7
+
8
+ require_relative 'mutations/base_mutation'
9
+ require_relative 'mutations/configure_identity_provider'
10
+ require_relative 'mutations/create_identity_provider'
11
+ require_relative 'mutations/set_saml_provider'
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Mutations
6
+ class BaseMutation < ::GraphQL::Schema::RelayClassicMutation
7
+ # This is used for generating payload types
8
+ object_class Types::BaseObject
9
+ # # This is used for return fields on the mutation's payload
10
+ # field_class Types::BaseField
11
+ # # This is used for generating the `input: { ... }` object type
12
+ # input_object_class Types::BaseInputObject
13
+
14
+ def return_data(data)
15
+ data.merge(errors: [])
16
+ end
17
+
18
+ def return_error(error)
19
+ error.merge(data: nil)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Mutations
6
+ class ConfigureIdentityProvider < BaseMutation
7
+ null false
8
+ argument :id, ID, required: true
9
+ argument :service, Types::IdentityProviderService, required: true
10
+ argument :sso_url, String, required: true
11
+ argument :sso_cert, String, required: true
12
+
13
+ field :identity_provider, Types::IdentityProvider, null: true
14
+ field :errors, [String], null: false
15
+
16
+ def resolve(id:, sso_url:, sso_cert:, service:)
17
+ provider = Osso::Models::SamlProvider.find(id)
18
+ provider.update(
19
+ idp_cert: sso_cert,
20
+ idp_sso_target_url: sso_url,
21
+ )
22
+
23
+ return_data(identity_provider: provider)
24
+ # rescue StandardError => e
25
+ # return_error(errors: e.full_message)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Mutations
6
+ class CreateIdentityProvider < BaseMutation
7
+ null false
8
+ argument :enterprise_account_id, ID, required: true
9
+ argument :provider_service, Types::IdentityProviderService, required: true
10
+
11
+ field :identity_provider, Types::IdentityProvider, null: false
12
+ field :errors, [String], null: false
13
+
14
+ def resolve(enterprise_account_id:, provider_service:)
15
+ enterprise_account = Osso::Models::EnterpriseAccount.find(enterprise_account_id)
16
+ identity_provider = enterprise_account.saml_providers.create!(
17
+ provider: provider_service || 'OKTA',
18
+ domain: enterprise_account.domain,
19
+ )
20
+
21
+ return_data(identity_provider: identity_provider)
22
+ rescue StandardError => e
23
+ return_error(errors: e.full_message)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Mutations
6
+ class SetSamlProvider < BaseMutation
7
+ null false
8
+
9
+ argument :provider, Types::IdentityProviderService, required: true
10
+ argument :id, ID, required: true
11
+
12
+ field :identity_provider, Types::IdentityProvider, null: false
13
+ field :errors, [String], null: false
14
+
15
+ def resolve(provider:, id:)
16
+ saml_provider = Osso::Models::SamlProvider.find(id)
17
+ saml_provider.provider = provider
18
+ saml_provider.save!
19
+ {
20
+ saml_provider: saml_provider,
21
+ errors: [],
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Types
6
+ class QueryType < ::GraphQL::Schema::Object
7
+ field :enterprise_accounts, null: true, resolver: Resolvers::EnterpriseAccounts
8
+ field :oauth_clients, null: true, resolver: Resolvers::OAuthClients
9
+
10
+ field :enterprise_account, null: false, resolver: Resolvers::EnterpriseAccount do
11
+ argument :domain, String, required: true
12
+ end
13
+
14
+ field(
15
+ :identity_provider,
16
+ Types::IdentityProvider,
17
+ null: true,
18
+ resolve: ->(_obj, args, _context) { Osso::Models::SamlProvider.find(args[:id]) },
19
+ ) do
20
+ argument :id, ID, required: true
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Resolvers
6
+ end
7
+ end
8
+ end
9
+
10
+ require_relative 'resolvers/enterprise_account'
11
+ require_relative 'resolvers/enterprise_accounts'
12
+ require_relative 'resolvers/oauth_clients'
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Resolvers
6
+ class EnterpriseAccount < ::GraphQL::Schema::Resolver
7
+ type Types::EnterpriseAccount, null: false
8
+
9
+ def resolve(args)
10
+ return unless admin? || enterprise_authorized?(args[:domain])
11
+
12
+ Osso::Models::EnterpriseAccount.find_by(domain: args[:domain])
13
+ end
14
+
15
+ def admin?
16
+ context[:scope] == :admin
17
+ end
18
+
19
+ def enterprise_authorized?(domain)
20
+ context[:scope] == domain
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Resolvers
6
+ class EnterpriseAccounts < ::GraphQL::Schema::Resolver
7
+ type [Types::EnterpriseAccount], null: true
8
+
9
+ def resolve
10
+ return Osso::Models::EnterpriseAccount.all if context[:scope] == :admin
11
+
12
+ Array(Osso::Models::EnterpriseAccount.find_by(domain: context[:scope]))
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Resolvers
6
+ class OAuthClients < ::GraphQL::Schema::Resolver
7
+ type [Types::OAuthClient], null: true
8
+
9
+ def resolve
10
+ return Osso::Models::OAuthClient.all if context[:scope] == :admin
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,42 @@
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
+ module Osso
15
+ module GraphQL
16
+ class Schema < ::GraphQL::Schema
17
+ use ::GraphQL::Pagination::Connections
18
+ query Types::QueryType
19
+ mutation Types::MutationType
20
+
21
+ def self.id_from_object(object, _type_definition = nil, _query_ctx = nil)
22
+ GraphQL::Schema::UniqueWithinType.encode(object.class.name, object.id)
23
+ end
24
+
25
+ def self.object_from_id(id, _query_ctx = nil)
26
+ class_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id)
27
+ Object.const_get(class_name).find(item_id)
28
+ end
29
+
30
+ def self.resolve_type(_type, obj, _ctx)
31
+ case obj
32
+ when Osso::Models::EnterpriseAccount
33
+ Types::EnterpriseAccount
34
+ when Osso::Models::SamlProvider
35
+ Types::IdentityProvider
36
+ else
37
+ raise("Unexpected object: #{obj}")
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module Types
5
+ end
6
+ end
7
+
8
+ require_relative 'types/base_object'
9
+ require_relative 'types/base_enum'
10
+ require_relative 'types/identity_provider_service'
11
+ require_relative 'types/identity_provider'
12
+ require_relative 'types/enterprise_account'
13
+ require_relative 'types/oauth_client'
14
+ require_relative 'types/user'
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Types
6
+ class BaseEnum < ::GraphQL::Schema::Enum
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql'
4
+
5
+ module Osso
6
+ module GraphQL
7
+ module Types
8
+ class BaseObject < ::GraphQL::Schema::Object
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql'
4
+
5
+ module Osso
6
+ module GraphQL
7
+ module Types
8
+ class EnterpriseAccount < Types::BaseObject
9
+ description 'An Account for a company that wishes to use SAML via Osso'
10
+ implements ::GraphQL::Types::Relay::Node
11
+
12
+ global_id_field :gid
13
+ field :id, ID, null: false
14
+ field :name, String, null: false
15
+ field :domain, String, null: false
16
+ field :identity_providers, [Types::IdentityProvider], null: true
17
+ field :status, String, null: false
18
+
19
+ def name
20
+ object.domain.gsub('.com', '')
21
+ end
22
+
23
+ def status
24
+ 'active'
25
+ end
26
+
27
+ def identity_providers
28
+ object.saml_providers
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql'
4
+
5
+ module Osso
6
+ module GraphQL
7
+ module Types
8
+ class IdentityProvider < Types::BaseObject
9
+ description 'Represents a SAML based IDP instance for an EnterpriseAccount'
10
+ implements ::GraphQL::Types::Relay::Node
11
+
12
+ global_id_field :gid
13
+ field :id, ID, null: false
14
+ field :enterprise_account_id, ID, null: false
15
+ field :service, Types::IdentityProviderService, null: true
16
+ field :domain, String, null: false
17
+ field :acs_url, String, null: false
18
+ field :sso_url, String, null: true
19
+ field :sso_cert, String, null: true
20
+ field :configured, Boolean, null: false
21
+
22
+ def service
23
+ @object.provider
24
+ end
25
+
26
+ def configured
27
+ @object.idp_sso_target_url && @object.idp_cert
28
+ end
29
+
30
+ def sso_cert
31
+ @object.idp_cert
32
+ end
33
+
34
+ def sso_url
35
+ @object.idp_sso_target_url
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Osso
4
+ module GraphQL
5
+ module Types
6
+ class IdentityProviderService < BaseEnum
7
+ value('AZURE', 'Microsoft Azure Identity Provider', value: 'Osso::Models::AzureSamlProvider')
8
+ value('OKTA', 'Okta Identity Provider', value: 'Osso::Models::OktaSamlProvider')
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql'
4
+
5
+ module Osso
6
+ module GraphQL
7
+ module Types
8
+ class OAuthClient < Types::BaseObject
9
+ description 'An OAuth client used to consume Osso SAML users'
10
+ implements ::GraphQL::Types::Relay::Node
11
+
12
+ global_id_field :gid
13
+ field :id, ID, null: false
14
+ field :name, String, null: false
15
+ field :client_id, String, null: false
16
+ field :client_secret, String, null: false
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql'
4
+ require_relative 'base_object'
5
+
6
+ module Osso
7
+ module GraphQL
8
+ module Types
9
+ class User < Types::BaseObject
10
+ description 'A User of the application'
11
+
12
+ field :id, ID, null: false
13
+ field :name, String, null: true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,67 +1,71 @@
1
1
  # frozen_string_literal: true
2
2
 
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)
10
-
11
- redirect ENV['JWT_URL']
12
- end
3
+ module Osso
4
+ module Helpers
5
+ module Auth
6
+ attr_accessor :current_scope
13
7
 
14
- def enterprise_authorized?(domain)
15
- payload, _args = JWT.decode(
16
- token,
17
- ENV['JWT_HMAC_SECRET'],
18
- true,
19
- { algorithm: 'HS256' },
20
- )
8
+ def enterprise_protected!(domain = nil)
9
+ return if admin_authorized?
10
+ return if enterprise_authorized?(domain)
21
11
 
22
- @current_scope = payload['scope']
12
+ halt 401 if request.post?
23
13
 
24
- true
25
- rescue JWT::DecodeError
26
- false
27
- end
14
+ redirect ENV['JWT_URL']
15
+ end
28
16
 
29
- def admin_protected!
30
- return if admin_authorized?
17
+ def enterprise_authorized?(_domain)
18
+ payload, _args = JWT.decode(
19
+ token,
20
+ ENV['JWT_HMAC_SECRET'],
21
+ true,
22
+ { algorithm: 'HS256' },
23
+ )
31
24
 
32
- redirect ENV['JWT_URL']
33
- end
25
+ @current_scope = payload['scope']
34
26
 
35
- def admin_authorized?
36
- payload, _args = JWT.decode(
37
- token,
38
- ENV['JWT_HMAC_SECRET'],
39
- true,
40
- { algorithm: 'HS256' },
41
- )
42
-
43
- if payload['scope'] == 'admin'
44
- @current_scope = :admin
45
- return true
27
+ true
28
+ rescue JWT::DecodeError
29
+ false
46
30
  end
47
31
 
48
- false
49
- rescue JWT::DecodeError
50
- false
51
- end
32
+ def admin_protected!
33
+ return if admin_authorized?
52
34
 
53
- def token
54
- request.env['admin_token'] || session['admin_token'] || request['admin_token']
55
- end
35
+ redirect ENV['JWT_URL']
36
+ end
56
37
 
57
- def chomp_token
58
- return unless request['admin_token'].present?
38
+ def admin_authorized?
39
+ payload, _args = JWT.decode(
40
+ token,
41
+ ENV['JWT_HMAC_SECRET'],
42
+ true,
43
+ { algorithm: 'HS256' },
44
+ )
59
45
 
60
- session['admin_token'] = request['admin_token']
46
+ if payload['scope'] == 'admin'
47
+ @current_scope = :admin
48
+ return true
49
+ end
61
50
 
62
- return if request.post?
51
+ false
52
+ rescue JWT::DecodeError
53
+ false
54
+ end
55
+
56
+ def token
57
+ request.env['admin_token'] || session['admin_token'] || request['admin_token']
58
+ end
59
+
60
+ def chomp_token
61
+ return unless request['admin_token'].present?
63
62
 
64
- redirect request.path
63
+ session['admin_token'] = request['admin_token']
64
+
65
+ return if request.post?
66
+
67
+ redirect request.path
68
+ end
65
69
  end
66
70
  end
67
71
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Helpers
3
+ module Osso
4
+ module Helpers
5
+ end
4
6
  end
5
7
 
6
8
  require_relative 'auth'
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Metrics/MethodLength
4
+
5
+ module Osso
6
+ module RouteMap
7
+ def self.included(klass)
8
+ klass.class_eval do
9
+ use Osso::Admin
10
+ use Osso::Auth
11
+ use Osso::Oauth
12
+
13
+ post '/graphql' do
14
+ enterprise_protected!
15
+
16
+ result = Osso::GraphQL::Schema.execute(
17
+ params[:query],
18
+ variables: params[:variables],
19
+ context: { scope: current_scope },
20
+ )
21
+
22
+ json result
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ # rubocop:enable Metrics/MethodLength
@@ -29,4 +29,4 @@ module Osso
29
29
  end
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -19,4 +19,4 @@ module Osso
19
19
  end
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -6,37 +6,36 @@ module Osso
6
6
  class Admin < Sinatra::Base
7
7
  include AppConfig
8
8
  helpers Helpers::Auth
9
+ register Sinatra::Namespace
9
10
 
10
11
  before do
11
12
  chomp_token
12
13
  end
13
14
 
14
- get '/' do
15
- admin_protected!
15
+ namespace '/admin' do
16
+ get '' do
17
+ admin_protected!
16
18
 
17
- erb :'public/index'
18
- end
19
-
20
- get '/enterprise' do
21
- admin_protected!
19
+ erb :admin
20
+ end
22
21
 
23
- erb :admin
24
- end
22
+ get '/enterprise' do
23
+ admin_protected!
25
24
 
26
- get '/enterprise/:domain' do
27
- enterprise_protected!(params[:domain])
25
+ erb :admin
26
+ end
28
27
 
29
- @enterprise = Models::EnterpriseAccount.where(
30
- domain: params[:domain],
31
- ).first_or_create
28
+ get '/enterprise/:domain' do
29
+ enterprise_protected!(params[:domain])
32
30
 
33
- erb :admin
34
- end
31
+ erb :admin
32
+ end
35
33
 
36
- get '/config' do
37
- admin_protected!
34
+ get '/config' do
35
+ admin_protected!
38
36
 
39
- erb :admin
37
+ erb :admin
38
+ end
40
39
  end
41
40
  end
42
41
  end
@@ -8,6 +8,7 @@ require 'omniauth-saml'
8
8
  module Osso
9
9
  class Auth < Sinatra::Base
10
10
  include AppConfig
11
+ register Sinatra::Namespace
11
12
 
12
13
  UUID_REGEXP =
13
14
  /[0-9a-f]{8}-[0-9a-f]{3,4}-[0-9a-f]{4}-[0-9a-f]{3,4}-[0-9a-f]{12}/.
@@ -30,35 +31,37 @@ module Osso
30
31
  end
31
32
  end
32
33
 
33
- # Enterprise users are sent here after authenticating against
34
- # their Identity Provider. We find or create a user record,
35
- # and then create an authorization code for that user. The user
36
- # is redirected back to your application with this code
37
- # as a URL query param, which you then exhange for an access token
38
- post '/saml/:id/callback' do
39
- provider = Models::SamlProvider.find(params[:id])
40
- oauth_client = provider.oauth_client
41
- redirect_uri = env['redirect_uri'] || oauth_client.default_redirect_uri.uri
34
+ namespace '/auth' do
35
+ # Enterprise users are sent here after authenticating against
36
+ # their Identity Provider. We find or create a user record,
37
+ # and then create an authorization code for that user. The user
38
+ # is redirected back to your application with this code
39
+ # as a URL query param, which you then exhange for an access token
40
+ post '/saml/:id/callback' do
41
+ provider = Models::SamlProvider.find(params[:id])
42
+ oauth_client = provider.oauth_client
43
+ redirect_uri = env['redirect_uri'] || oauth_client.default_redirect_uri.uri
42
44
 
43
- attributes = env['omniauth.auth']&.
44
- extra&.
45
- response_object&.
46
- attributes
45
+ attributes = env['omniauth.auth']&.
46
+ extra&.
47
+ response_object&.
48
+ attributes
47
49
 
48
- user = Models::User.where(
49
- email: attributes[:email],
50
- idp_id: attributes[:id],
51
- ).first_or_create! do |new_user|
52
- new_user.enterprise_account_id = provider.enterprise_account_id
53
- new_user.saml_provider_id = provider.id
54
- end
50
+ user = Models::User.where(
51
+ email: attributes[:email],
52
+ idp_id: attributes[:id],
53
+ ).first_or_create! do |new_user|
54
+ new_user.enterprise_account_id = provider.enterprise_account_id
55
+ new_user.saml_provider_id = provider.id
56
+ end
55
57
 
56
- authorization_code = user.authorization_codes.create!(
57
- oauth_client: oauth_client,
58
- redirect_uri: redirect_uri,
59
- )
58
+ authorization_code = user.authorization_codes.create!(
59
+ oauth_client: oauth_client,
60
+ redirect_uri: redirect_uri,
61
+ )
60
62
 
61
- redirect(redirect_uri + "?code=#{CGI.escape(authorization_code.token)}&state=#{session[:oauth_state]}")
63
+ redirect(redirect_uri + "?code=#{CGI.escape(authorization_code.token)}&state=#{session[:oauth_state]}")
64
+ end
62
65
  end
63
66
  end
64
67
  end
@@ -5,53 +5,59 @@ require 'rack/oauth2'
5
5
  module Osso
6
6
  class Oauth < Sinatra::Base
7
7
  include AppConfig
8
- # Send your users here in order to being an authentication
9
- # flow. This flow follows the authorization grant oauth
10
- # spec with one exception - you must also pass the domain
11
- # of the user who wants to sign in.
12
- get '/authorize' do
13
- @enterprise = Models::EnterpriseAccount.
14
- includes(:saml_providers).
15
- find_by!(domain: params[:domain])
16
-
17
- Rack::OAuth2::Server::Authorize.new do |req, _res|
18
- client = Models::OauthClient.find_by!(identifier: req.client_id)
19
- req.verify_redirect_uri!(client.redirect_uri_values)
20
- end.call(env)
21
-
22
- if @enterprise.single_provider?
23
- session[:oauth_state] = params[:state]
24
- redirect "/auth/saml/#{@enterprise.provider.id}"
8
+ register Sinatra::Namespace
9
+ # rubocop:disable Metrics/BlockLength
10
+ namespace '/oauth' do
11
+ # Send your users here in order to being an authentication
12
+ # flow. This flow follows the authorization grant oauth
13
+ # spec with one exception - you must also pass the domain
14
+ # of the user who wants to sign in.
15
+ get '/authorize' do
16
+ @enterprise = Models::EnterpriseAccount.
17
+ includes(:saml_providers).
18
+ find_by!(domain: params[:domain])
19
+
20
+ Rack::OAuth2::Server::Authorize.new do |req, _res|
21
+ client = Models::OauthClient.find_by!(identifier: req.client_id)
22
+ req.verify_redirect_uri!(client.redirect_uri_values)
23
+ end.call(env)
24
+
25
+ if @enterprise.single_provider?
26
+ session[:oauth_state] = params[:state]
27
+ redirect "/auth/saml/#{@enterprise.provider.id}"
28
+ end
29
+
30
+ # TODO: multiple provider support
31
+ # erb :multiple_providers
32
+
33
+ rescue Rack::OAuth2::Server::Authorize::BadRequest => e
34
+ @error = e
35
+ return erb :error
25
36
  end
26
37
 
27
- erb :multiple_providers
28
-
29
- rescue Rack::OAuth2::Server::Authorize::BadRequest => e
30
- @error = e
31
- return erb :error
32
- end
33
-
34
- # Exchange an authorization code token for an access token.
35
- # In addition to the token, you must include all paramaters
36
- # required by Oauth spec: redirect_uri, client ID, and client secret
37
- post '/token' do
38
- Rack::OAuth2::Server::Token.new do |req, res|
39
- code = Models::AuthorizationCode.
40
- find_by_token!(params[:code])
41
- client = Models::OauthClient.find_by!(identifier: req.client_id)
42
- req.invalid_client! if client.secret != req.client_secret
43
- req.invalid_grant! if code.redirect_uri != req.redirect_uri
44
- res.access_token = code.access_token.to_bearer_token
45
- end.call(env)
46
- end
38
+ # Exchange an authorization code token for an access token.
39
+ # In addition to the token, you must include all paramaters
40
+ # required by Oauth spec: redirect_uri, client ID, and client secret
41
+ post '/token' do
42
+ Rack::OAuth2::Server::Token.new do |req, res|
43
+ code = Models::AuthorizationCode.
44
+ find_by_token!(params[:code])
45
+ client = Models::OauthClient.find_by!(identifier: req.client_id)
46
+ req.invalid_client! if client.secret != req.client_secret
47
+ req.invalid_grant! if code.redirect_uri != req.redirect_uri
48
+ res.access_token = code.access_token.to_bearer_token
49
+ end.call(env)
50
+ end
47
51
 
48
- # Use the access token to request a user profile
49
- get '/me' do
50
- json Models::AccessToken.
51
- includes(:user).
52
- valid.
53
- find_by_token!(params[:access_token]).
54
- user
52
+ # Use the access token to request a user profile
53
+ get '/me' do
54
+ json Models::AccessToken.
55
+ includes(:user).
56
+ valid.
57
+ find_by_token!(params[:access_token]).
58
+ user
59
+ end
55
60
  end
56
61
  end
57
62
  end
63
+ # rubocop:enable Metrics/BlockLength
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Osso
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.3.5'
5
5
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative 'lib/osso/version'
4
4
 
5
+ # rubocop:disable Metrics/BlockLength
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = 'osso'
7
8
  spec.version = Osso::VERSION
@@ -15,6 +16,7 @@ Gem::Specification.new do |spec|
15
16
  spec.license = 'MIT'
16
17
 
17
18
  spec.add_runtime_dependency 'activesupport', '>= 6.0.3.2'
19
+ spec.add_runtime_dependency 'graphql'
18
20
  spec.add_runtime_dependency 'jwt'
19
21
  spec.add_runtime_dependency 'omniauth-multi-provider'
20
22
  spec.add_runtime_dependency 'omniauth-saml'
@@ -29,12 +31,10 @@ Gem::Specification.new do |spec|
29
31
  spec.add_development_dependency 'bundler', '~> 2.1'
30
32
  spec.add_development_dependency 'pry'
31
33
 
32
- # Specify which files should be added to the gem when it is released.
33
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
34
34
  spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
35
35
  spec.files = `git ls-files`.split("\n")
36
36
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
37
37
  spec.bindir = 'bin'
38
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
39
38
  spec.require_paths = ['lib']
40
39
  end
40
+ # rubocop:enable Metrics/BlockLength
@@ -9,6 +9,7 @@ describe Osso::Admin do
9
9
  before do
10
10
  ENV['JWT_URL'] = jwt_url
11
11
  ENV['JWT_HMAC_SECRET'] = jwt_hmac_secret
12
+ described_class.set(:views, spec_views)
12
13
  end
13
14
 
14
15
  describe 'get /admin' do
@@ -24,7 +25,9 @@ describe Osso::Admin do
24
25
  get('/admin', token: SecureRandom.hex(32))
25
26
 
26
27
  expect(last_response).to be_redirect
28
+
27
29
  follow_redirect!
30
+
28
31
  expect(last_request.url).to eq(jwt_url)
29
32
  end
30
33
 
@@ -14,15 +14,13 @@ ENV['SESSION_SECRET'] = 'supersecret'
14
14
 
15
15
  require File.expand_path '../lib/osso.rb', __dir__
16
16
 
17
+ require File.expand_path 'support/spec_app', __dir__
18
+
17
19
  module RSpecMixin
18
20
  include Rack::Test::Methods
19
21
 
20
22
  def app
21
- Rack::URLMap.new(
22
- '/admin' => Osso::Admin,
23
- '/auth' => Osso::Auth,
24
- '/oauth' => Osso::Oauth,
25
- )
23
+ SpecApp
26
24
  end
27
25
 
28
26
  def mock_saml_omniauth(email: 'user@enterprise.com', id: SecureRandom.uuid)
@@ -40,6 +38,10 @@ module RSpecMixin
40
38
  def last_json_response
41
39
  JSON.parse(last_response.body, symbolize_names: true)
42
40
  end
41
+
42
+ def spec_views
43
+ File.dirname(__FILE__) + '/support/views'
44
+ end
43
45
  end
44
46
 
45
47
  RSpec.configure do |config|
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class SpecApp < Sinatra::Base
4
+ include Osso::RouteMap
5
+
6
+ get '/health' do
7
+ 'ok'
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ <%#
2
+ NB: this file exists so that the admin routes have something to render in spec.
3
+ In real-world usage, those routes render an index.html file that includes the
4
+ React app.
5
+ %>
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.3
4
+ version: 0.0.3.5
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-07-04 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 6.0.3.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: graphql
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: jwt
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -218,6 +232,7 @@ files:
218
232
  - bin/console
219
233
  - bin/setup
220
234
  - config/database.yml
235
+ - db/schema.rb
221
236
  - lib/.DS_Store
222
237
  - lib/osso.rb
223
238
  - lib/osso/Rakefile
@@ -237,10 +252,32 @@ files:
237
252
  - lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_account.rb
238
253
  - lib/osso/db/migrate/20200601131227_drop_null_constraint_from_saml_providers_provider.rb
239
254
  - lib/osso/db/schema.rb
255
+ - lib/osso/graphql/.DS_Store
256
+ - lib/osso/graphql/mutation.rb
257
+ - lib/osso/graphql/mutations.rb
258
+ - lib/osso/graphql/mutations/base_mutation.rb
259
+ - lib/osso/graphql/mutations/configure_identity_provider.rb
260
+ - lib/osso/graphql/mutations/create_identity_provider.rb
261
+ - lib/osso/graphql/mutations/set_saml_provider.rb
262
+ - lib/osso/graphql/query.rb
263
+ - lib/osso/graphql/resolvers.rb
264
+ - lib/osso/graphql/resolvers/enterprise_account.rb
265
+ - lib/osso/graphql/resolvers/enterprise_accounts.rb
266
+ - lib/osso/graphql/resolvers/oauth_clients.rb
267
+ - lib/osso/graphql/schema.rb
268
+ - lib/osso/graphql/types.rb
269
+ - lib/osso/graphql/types/base_enum.rb
270
+ - lib/osso/graphql/types/base_object.rb
271
+ - lib/osso/graphql/types/enterprise_account.rb
272
+ - lib/osso/graphql/types/identity_provider.rb
273
+ - lib/osso/graphql/types/identity_provider_service.rb
274
+ - lib/osso/graphql/types/oauth_client.rb
275
+ - lib/osso/graphql/types/user.rb
240
276
  - lib/osso/helpers/auth.rb
241
277
  - lib/osso/helpers/helpers.rb
242
278
  - lib/osso/lib/app_config.rb
243
279
  - lib/osso/lib/oauth2_token.rb
280
+ - lib/osso/lib/route_map.rb
244
281
  - lib/osso/models/access_token.rb
245
282
  - lib/osso/models/authorization_code.rb
246
283
  - lib/osso/models/enterprise_account.rb
@@ -275,7 +312,8 @@ files:
275
312
  - spec/routes/auth_spec.rb
276
313
  - spec/routes/oauth_spec.rb
277
314
  - spec/spec_helper.rb
278
- - spec/support/vcr_cassettes/okta_saml_callback.yml
315
+ - spec/support/spec_app.rb
316
+ - spec/support/views/admin.erb
279
317
  homepage: https://github.com/enterprise-oss/osso-rb
280
318
  licenses:
281
319
  - MIT
@@ -1,59 +0,0 @@
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=PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c2FtbDJwOlJlc3BvbnNlIERlc3RpbmF0aW9uPSJodHRwOi8vbG9jYWxob3N0OjkyOTIvYXV0aC9zYW1sLzY4ZTkwNTdjLTQ2MmYtNDM3Zi04NDRkLTk4NzI0ZmVmOWQ0My9jYWxsYmFjayIgSUQ9ImlkMTgyOTI5NzEwODgzMjU2OTIyMDE3Nzc0NDUyIiBJblJlc3BvbnNlVG89Il81NGM0ZjE5MS0xYmY3LTRiMDItOTZlYS0zNGQ4NTU1YWVjYWEiIElzc3VlSW5zdGFudD0iMjAyMC0wNC0xMVQxNjozMjoxOC40MjRaIiBWZXJzaW9uPSIyLjAiIHhtbG5zOnNhbWwycD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3RvY29sIiB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiPjxzYW1sMjpJc3N1ZXIgRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6bmFtZWlkLWZvcm1hdDplbnRpdHkiIHhtbG5zOnNhbWwyPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXNzZXJ0aW9uIj5odHRwOi8vd3d3Lm9rdGEuY29tL2V4azUxMzI2YjNVMTk0MUhmNHg2PC9zYW1sMjpJc3N1ZXI%2BPGRzOlNpZ25hdHVyZSB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyI%2BPGRzOlNpZ25lZEluZm8%2BPGRzOkNhbm9u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bG5zOnhzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnR5cGU9InhzOnN0cmluZyI%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