osso 0.0.3.4 → 0.0.3.9

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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/pipeline.yml +6 -1
  3. data/.rubocop.yml +1 -2
  4. data/Gemfile.lock +5 -1
  5. data/bin/annotate +1 -0
  6. data/bin/console +4 -3
  7. data/config/database.yml +2 -2
  8. data/db/schema.rb +90 -1
  9. data/lib/osso.rb +1 -0
  10. data/lib/osso/db/migrate/20200328143305_create_identity_providers.rb +12 -0
  11. data/lib/osso/db/migrate/20200411184535_add_provider_id_to_users.rb +2 -2
  12. data/lib/osso/db/migrate/20200411192645_create_enterprise_accounts.rb +1 -1
  13. data/lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_accounts_and_identity_providers.rb +6 -0
  14. data/lib/osso/db/migrate/20200714223226_add_identity_provider_service_enum.rb +17 -0
  15. data/lib/osso/db/migrate/20200715154211_rename_idp_fields_on_identity_provider_to_sso.rb +6 -0
  16. data/lib/osso/db/migrate/20200715205801_add_name_to_enterprise_account.rb +5 -0
  17. data/lib/osso/db/migrate/20200722230116_add_identity_provider_status_enum_and_use_on_identity_providers.rb +15 -0
  18. data/lib/osso/db/migrate/20200723153750_add_missing_timestamps.rb +35 -0
  19. data/lib/osso/db/migrate/20200723162228_drop_unneeded_tables.rb +9 -0
  20. data/lib/osso/graphql/mutation.rb +5 -2
  21. data/lib/osso/graphql/mutations.rb +5 -1
  22. data/lib/osso/graphql/mutations/base_mutation.rb +24 -7
  23. data/lib/osso/graphql/mutations/configure_identity_provider.rb +19 -13
  24. data/lib/osso/graphql/mutations/create_enterprise_account.rb +25 -0
  25. data/lib/osso/graphql/mutations/create_identity_provider.rb +9 -7
  26. data/lib/osso/graphql/mutations/create_oauth_client.rb +30 -0
  27. data/lib/osso/graphql/mutations/delete_enterprise_account.rb +34 -0
  28. data/lib/osso/graphql/mutations/delete_oauth_client.rb +30 -0
  29. data/lib/osso/graphql/query.rb +2 -2
  30. data/lib/osso/graphql/resolvers/oauth_clients.rb +2 -2
  31. data/lib/osso/graphql/schema.rb +5 -1
  32. data/lib/osso/graphql/types.rb +2 -0
  33. data/lib/osso/graphql/types/base_input_object.rb +10 -0
  34. data/lib/osso/graphql/types/base_object.rb +2 -0
  35. data/lib/osso/graphql/types/enterprise_account.rb +5 -5
  36. data/lib/osso/graphql/types/identity_provider.rb +6 -13
  37. data/lib/osso/graphql/types/identity_provider_service.rb +1 -1
  38. data/lib/osso/graphql/types/identity_provider_status.rb +14 -0
  39. data/lib/osso/graphql/types/oauth_client.rb +13 -1
  40. data/lib/osso/helpers/auth.rb +16 -15
  41. data/lib/osso/lib/app_config.rb +1 -1
  42. data/lib/osso/lib/route_map.rb +28 -0
  43. data/lib/osso/models/access_token.rb +18 -0
  44. data/lib/osso/models/authorization_code.rb +20 -0
  45. data/lib/osso/models/enterprise_account.rb +24 -4
  46. data/lib/osso/models/identity_provider.rb +77 -0
  47. data/lib/osso/models/models.rb +3 -1
  48. data/lib/osso/models/oauth_client.rb +19 -3
  49. data/lib/osso/models/redirect_uri.rb +17 -0
  50. data/lib/osso/models/user.rb +25 -3
  51. data/lib/osso/routes/admin.rb +18 -15
  52. data/lib/osso/routes/auth.rb +30 -27
  53. data/lib/osso/routes/oauth.rb +50 -45
  54. data/lib/osso/version.rb +1 -1
  55. data/osso-rb.gemspec +3 -3
  56. data/spec/factories/enterprise_account.rb +5 -4
  57. data/spec/factories/identity_providers.rb +71 -0
  58. data/spec/factories/user.rb +1 -1
  59. data/spec/graphql/mutations/configure_identity_provider_spec.rb +75 -0
  60. data/spec/graphql/mutations/create_enterprise_account_spec.rb +68 -0
  61. data/spec/graphql/mutations/create_identity_provider_spec.rb +104 -0
  62. data/spec/graphql/mutations/create_oauth_client_spec.rb +55 -0
  63. data/spec/graphql/mutations/delete_enterprise_account_spec.rb +63 -0
  64. data/spec/graphql/mutations/delete_oauth_client_spec.rb +51 -0
  65. data/spec/graphql/query/enterprise_account_spec.rb +68 -0
  66. data/spec/graphql/query/enterprise_accounts_spec.rb +44 -0
  67. data/spec/graphql/query/identity_provider_spec.rb +65 -0
  68. data/spec/graphql/query/oauth_clients_spec.rb +50 -0
  69. data/spec/models/azure_saml_provider_spec.rb +14 -14
  70. data/spec/models/identity_provider_spec.rb +17 -0
  71. data/spec/models/okta_saml_provider_spec.rb +15 -15
  72. data/spec/routes/admin_spec.rb +2 -0
  73. data/spec/routes/auth_spec.rb +9 -9
  74. data/spec/routes/oauth_spec.rb +1 -1
  75. data/spec/spec_helper.rb +4 -5
  76. data/spec/support/spec_app.rb +9 -0
  77. metadata +47 -16
  78. data/lib/osso/db/migrate/20200328143303_create_oauth_tables.rb +0 -57
  79. data/lib/osso/db/migrate/20200411144528_create_saml_providers.rb +0 -13
  80. data/lib/osso/db/migrate/20200413153029_add_oauth_client_reference_to_saml_providers.rb +0 -5
  81. data/lib/osso/db/migrate/20200501203026_drop_null_constraints_from_saml_provider.rb +0 -7
  82. data/lib/osso/db/migrate/20200501204047_drop_acs_url.rb +0 -5
  83. data/lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_account.rb +0 -5
  84. data/lib/osso/db/migrate/20200601131227_drop_null_constraint_from_saml_providers_provider.rb +0 -7
  85. data/lib/osso/db/schema.rb +0 -132
  86. data/lib/osso/graphql/mutations/set_saml_provider.rb +0 -27
  87. data/lib/osso/models/saml_provider.rb +0 -52
  88. data/lib/osso/models/saml_providers/azure_saml_provider.rb +0 -22
  89. data/lib/osso/models/saml_providers/okta_saml_provider.rb +0 -23
  90. data/spec/factories/saml_providers.rb +0 -46
  91. data/spec/models/saml_provider_spec.rb +0 -31
@@ -35,7 +35,7 @@ describe Osso::Oauth do
35
35
  redirect_uri: client.redirect_uri_values.sample,
36
36
  )
37
37
 
38
- provider_id = enterprise.saml_providers.first.id
38
+ provider_id = enterprise.identity_providers.first.id
39
39
 
40
40
  expect(last_response).to be_redirect
41
41
  follow_redirect!
@@ -11,18 +11,17 @@ require 'webmock/rspec'
11
11
 
12
12
  ENV['RACK_ENV'] = 'test'
13
13
  ENV['SESSION_SECRET'] = 'supersecret'
14
+ ENV['BASE_URL'] = 'https://example.com'
14
15
 
15
16
  require File.expand_path '../lib/osso.rb', __dir__
16
17
 
18
+ require File.expand_path 'support/spec_app', __dir__
19
+
17
20
  module RSpecMixin
18
21
  include Rack::Test::Methods
19
22
 
20
23
  def app
21
- Rack::URLMap.new(
22
- '/admin' => Osso::Admin,
23
- '/auth' => Osso::Auth,
24
- '/oauth' => Osso::Oauth,
25
- )
24
+ SpecApp
26
25
  end
27
26
 
28
27
  def mock_saml_omniauth(email: 'user@enterprise.com', id: SecureRandom.uuid)
@@ -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
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
4
+ version: 0.0.3.9
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-09 00:00:00.000000000 Z
11
+ date: 2020-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: annotate
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '3.1'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '3.1'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: bundler
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -210,6 +224,7 @@ description: This gem includes the main functionality for Osso apps,
210
224
  email:
211
225
  - sbauch@gmail.com
212
226
  executables:
227
+ - annotate
213
228
  - console
214
229
  - setup
215
230
  extensions: []
@@ -229,6 +244,7 @@ files:
229
244
  - LICENSE
230
245
  - README.md
231
246
  - Rakefile
247
+ - bin/annotate
232
248
  - bin/console
233
249
  - bin/setup
234
250
  - config/database.yml
@@ -238,27 +254,30 @@ files:
238
254
  - lib/osso/Rakefile
239
255
  - lib/osso/db/migrate/20190909230109_enable_uuid.rb
240
256
  - lib/osso/db/migrate/20200328135750_create_users.rb
241
- - lib/osso/db/migrate/20200328143303_create_oauth_tables.rb
242
- - lib/osso/db/migrate/20200411144528_create_saml_providers.rb
257
+ - lib/osso/db/migrate/20200328143305_create_identity_providers.rb
243
258
  - lib/osso/db/migrate/20200411184535_add_provider_id_to_users.rb
244
259
  - lib/osso/db/migrate/20200411192645_create_enterprise_accounts.rb
245
260
  - lib/osso/db/migrate/20200413132407_add_oauth_clients.rb
246
261
  - lib/osso/db/migrate/20200413142511_create_authorization_codes.rb
247
- - lib/osso/db/migrate/20200413153029_add_oauth_client_reference_to_saml_providers.rb
248
262
  - lib/osso/db/migrate/20200413163451_create_access_tokens.rb
249
- - lib/osso/db/migrate/20200501203026_drop_null_constraints_from_saml_provider.rb
250
- - lib/osso/db/migrate/20200501204047_drop_acs_url.rb
251
263
  - lib/osso/db/migrate/20200502120616_create_redirect_uris_and_drop_from_oauth_clients.rb
252
- - lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_account.rb
253
- - lib/osso/db/migrate/20200601131227_drop_null_constraint_from_saml_providers_provider.rb
254
- - lib/osso/db/schema.rb
264
+ - lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_accounts_and_identity_providers.rb
265
+ - lib/osso/db/migrate/20200714223226_add_identity_provider_service_enum.rb
266
+ - lib/osso/db/migrate/20200715154211_rename_idp_fields_on_identity_provider_to_sso.rb
267
+ - lib/osso/db/migrate/20200715205801_add_name_to_enterprise_account.rb
268
+ - lib/osso/db/migrate/20200722230116_add_identity_provider_status_enum_and_use_on_identity_providers.rb
269
+ - lib/osso/db/migrate/20200723153750_add_missing_timestamps.rb
270
+ - lib/osso/db/migrate/20200723162228_drop_unneeded_tables.rb
255
271
  - lib/osso/graphql/.DS_Store
256
272
  - lib/osso/graphql/mutation.rb
257
273
  - lib/osso/graphql/mutations.rb
258
274
  - lib/osso/graphql/mutations/base_mutation.rb
259
275
  - lib/osso/graphql/mutations/configure_identity_provider.rb
276
+ - lib/osso/graphql/mutations/create_enterprise_account.rb
260
277
  - lib/osso/graphql/mutations/create_identity_provider.rb
261
- - lib/osso/graphql/mutations/set_saml_provider.rb
278
+ - lib/osso/graphql/mutations/create_oauth_client.rb
279
+ - lib/osso/graphql/mutations/delete_enterprise_account.rb
280
+ - lib/osso/graphql/mutations/delete_oauth_client.rb
262
281
  - lib/osso/graphql/query.rb
263
282
  - lib/osso/graphql/resolvers.rb
264
283
  - lib/osso/graphql/resolvers/enterprise_account.rb
@@ -267,25 +286,26 @@ files:
267
286
  - lib/osso/graphql/schema.rb
268
287
  - lib/osso/graphql/types.rb
269
288
  - lib/osso/graphql/types/base_enum.rb
289
+ - lib/osso/graphql/types/base_input_object.rb
270
290
  - lib/osso/graphql/types/base_object.rb
271
291
  - lib/osso/graphql/types/enterprise_account.rb
272
292
  - lib/osso/graphql/types/identity_provider.rb
273
293
  - lib/osso/graphql/types/identity_provider_service.rb
294
+ - lib/osso/graphql/types/identity_provider_status.rb
274
295
  - lib/osso/graphql/types/oauth_client.rb
275
296
  - lib/osso/graphql/types/user.rb
276
297
  - lib/osso/helpers/auth.rb
277
298
  - lib/osso/helpers/helpers.rb
278
299
  - lib/osso/lib/app_config.rb
279
300
  - lib/osso/lib/oauth2_token.rb
301
+ - lib/osso/lib/route_map.rb
280
302
  - lib/osso/models/access_token.rb
281
303
  - lib/osso/models/authorization_code.rb
282
304
  - lib/osso/models/enterprise_account.rb
305
+ - lib/osso/models/identity_provider.rb
283
306
  - lib/osso/models/models.rb
284
307
  - lib/osso/models/oauth_client.rb
285
308
  - lib/osso/models/redirect_uri.rb
286
- - lib/osso/models/saml_provider.rb
287
- - lib/osso/models/saml_providers/azure_saml_provider.rb
288
- - lib/osso/models/saml_providers/okta_saml_provider.rb
289
309
  - lib/osso/models/user.rb
290
310
  - lib/osso/rake.rb
291
311
  - lib/osso/routes/admin.rb
@@ -299,18 +319,29 @@ files:
299
319
  - osso-rb.gemspec
300
320
  - spec/factories/authorization_code.rb
301
321
  - spec/factories/enterprise_account.rb
322
+ - spec/factories/identity_providers.rb
302
323
  - spec/factories/oauth_client.rb
303
324
  - spec/factories/redirect_uri.rb
304
- - spec/factories/saml_providers.rb
305
325
  - spec/factories/user.rb
326
+ - spec/graphql/mutations/configure_identity_provider_spec.rb
327
+ - spec/graphql/mutations/create_enterprise_account_spec.rb
328
+ - spec/graphql/mutations/create_identity_provider_spec.rb
329
+ - spec/graphql/mutations/create_oauth_client_spec.rb
330
+ - spec/graphql/mutations/delete_enterprise_account_spec.rb
331
+ - spec/graphql/mutations/delete_oauth_client_spec.rb
332
+ - spec/graphql/query/enterprise_account_spec.rb
333
+ - spec/graphql/query/enterprise_accounts_spec.rb
334
+ - spec/graphql/query/identity_provider_spec.rb
335
+ - spec/graphql/query/oauth_clients_spec.rb
306
336
  - spec/models/azure_saml_provider_spec.rb
337
+ - spec/models/identity_provider_spec.rb
307
338
  - spec/models/okta_saml_provider_spec.rb
308
- - spec/models/saml_provider_spec.rb
309
339
  - spec/routes/admin_spec.rb
310
340
  - spec/routes/app_spec.rb
311
341
  - spec/routes/auth_spec.rb
312
342
  - spec/routes/oauth_spec.rb
313
343
  - spec/spec_helper.rb
344
+ - spec/support/spec_app.rb
314
345
  - spec/support/views/admin.erb
315
346
  homepage: https://github.com/enterprise-oss/osso-rb
316
347
  licenses:
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateOauthTables < ActiveRecord::Migration[6.0]
4
- def change
5
- create_table :oauth_applications, id: :uuid do |t|
6
- t.string :name, null: false
7
- t.string :secret, null: false
8
- t.text :redirect_uri, null: false
9
- t.string :scopes, null: false, default: ''
10
- t.boolean :confidential, null: false, default: true
11
- t.timestamps null: false
12
- end
13
-
14
- create_table :oauth_access_grants, id: :uuid do |t|
15
- t.uuid :resource_owner_id, null: false
16
- t.references :application, type: :uuid, null: false
17
- t.string :token, null: false
18
- t.integer :expires_in, null: false
19
- t.text :redirect_uri, null: false
20
- t.datetime :created_at, null: false
21
- t.datetime :revoked_at
22
- t.string :scopes, null: false, default: ''
23
- end
24
-
25
- add_index :oauth_access_grants, :token, unique: true
26
- add_foreign_key(
27
- :oauth_access_grants,
28
- :oauth_applications,
29
- column: :application_id
30
- )
31
-
32
- create_table :oauth_access_tokens, id: :uuid do |t|
33
- t.uuid :resource_owner_id
34
- t.references :application, type: :uuid
35
- t.string :token, null: false
36
-
37
- t.string :refresh_token
38
- t.integer :expires_in
39
- t.datetime :revoked_at
40
- t.datetime :created_at, null: false
41
- t.string :scopes
42
-
43
- t.string :previous_refresh_token, null: false, default: ''
44
- end
45
-
46
- add_index :oauth_access_tokens, :token, unique: true
47
- add_index :oauth_access_tokens, :refresh_token, unique: true
48
- add_foreign_key(
49
- :oauth_access_tokens,
50
- :oauth_applications,
51
- column: :application_id
52
- )
53
-
54
- add_foreign_key :oauth_access_grants, :users, column: :resource_owner_id
55
- add_foreign_key :oauth_access_tokens, :users, column: :resource_owner_id
56
- end
57
- end
@@ -1,13 +0,0 @@
1
- class CreateSamlProviders < ActiveRecord::Migration[6.0]
2
- def change
3
- create_table :saml_providers, id: :uuid do |t|
4
- t.string :provider, null: false
5
- t.string :domain, null: false
6
- t.string :idp_sso_target_url, null: false
7
- t.text :idp_cert, null: false
8
- t.string :assertion_consumer_service_url
9
- end
10
-
11
- add_index :saml_providers, [:domain, :provider], unique: true
12
- end
13
- end
@@ -1,5 +0,0 @@
1
- class AddOauthClientReferenceToSamlProviders < ActiveRecord::Migration[6.0]
2
- def change
3
- add_reference :saml_providers, :oauth_client, type: :uuid, index: true
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- class DropNullConstraintsFromSamlProvider < ActiveRecord::Migration[6.0]
2
- def change
3
- change_column :saml_providers, :idp_sso_target_url, :string, null: true
4
- change_column :saml_providers, :idp_cert, :text, null: true
5
- change_column :saml_providers, :assertion_consumer_service_url, :string, null: false
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- class DropAcsUrl < ActiveRecord::Migration[6.0]
2
- def change
3
- remove_column :saml_providers, :assertion_consumer_service_url
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddOauthClientIdToEnterpriseAccount < ActiveRecord::Migration[6.0]
2
- def change
3
- add_reference :enterprise_accounts, :oauth_client, type: :uuid, index: true
4
- end
5
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class DropNullConstraintFromSamlProvidersProvider < ActiveRecord::Migration[6.0]
4
- def change
5
- change_column :saml_providers, :provider, :string, null: true
6
- end
7
- end
@@ -1,132 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # This file is the source Rails uses to define your schema when running `rails
6
- # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
7
- # be faster and is potentially less error prone than running all of your
8
- # migrations from scratch. Old migrations may fail to apply correctly if those
9
- # migrations use external dependencies or application code.
10
- #
11
- # It's strongly recommended that you check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(version: 2020_05_02_135008) do
14
-
15
- # These are extensions that must be enabled in order to support this database
16
- enable_extension "pgcrypto"
17
- enable_extension "plpgsql"
18
-
19
- create_table "access_tokens", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
20
- t.string "token"
21
- t.datetime "expires_at"
22
- t.datetime "created_at", precision: 6, null: false
23
- t.datetime "updated_at", precision: 6, null: false
24
- t.uuid "user_id"
25
- t.uuid "oauth_client_id"
26
- t.index ["oauth_client_id"], name: "index_access_tokens_on_oauth_client_id"
27
- t.index ["user_id"], name: "index_access_tokens_on_user_id"
28
- end
29
-
30
- create_table "authorization_codes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
31
- t.string "token"
32
- t.string "redirect_uri"
33
- t.datetime "expires_at"
34
- t.datetime "created_at", precision: 6, null: false
35
- t.datetime "updated_at", precision: 6, null: false
36
- t.uuid "user_id"
37
- t.uuid "oauth_client_id"
38
- t.index ["oauth_client_id"], name: "index_authorization_codes_on_oauth_client_id"
39
- t.index ["token"], name: "index_authorization_codes_on_token", unique: true
40
- t.index ["user_id"], name: "index_authorization_codes_on_user_id"
41
- end
42
-
43
- create_table "enterprise_accounts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
44
- t.string "domain", null: false
45
- t.uuid "external_uuid"
46
- t.integer "external_int_id"
47
- t.string "external_id"
48
- t.uuid "oauth_client_id"
49
- t.index ["domain"], name: "index_enterprise_accounts_on_domain", unique: true
50
- t.index ["oauth_client_id"], name: "index_enterprise_accounts_on_oauth_client_id"
51
- end
52
-
53
- create_table "oauth_access_grants", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
54
- t.uuid "resource_owner_id", null: false
55
- t.uuid "application_id", null: false
56
- t.string "token", null: false
57
- t.integer "expires_in", null: false
58
- t.text "redirect_uri", null: false
59
- t.datetime "created_at", null: false
60
- t.datetime "revoked_at"
61
- t.string "scopes", default: "", null: false
62
- t.index ["application_id"], name: "index_oauth_access_grants_on_application_id"
63
- t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true
64
- end
65
-
66
- create_table "oauth_access_tokens", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
67
- t.uuid "resource_owner_id"
68
- t.uuid "application_id"
69
- t.string "token", null: false
70
- t.string "refresh_token"
71
- t.integer "expires_in"
72
- t.datetime "revoked_at"
73
- t.datetime "created_at", null: false
74
- t.string "scopes"
75
- t.string "previous_refresh_token", default: "", null: false
76
- t.index ["application_id"], name: "index_oauth_access_tokens_on_application_id"
77
- t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true
78
- t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true
79
- end
80
-
81
- create_table "oauth_applications", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
82
- t.string "name", null: false
83
- t.string "secret", null: false
84
- t.text "redirect_uri", null: false
85
- t.string "scopes", default: "", null: false
86
- t.boolean "confidential", default: true, null: false
87
- t.datetime "created_at", precision: 6, null: false
88
- t.datetime "updated_at", precision: 6, null: false
89
- end
90
-
91
- create_table "oauth_clients", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
92
- t.string "name", null: false
93
- t.string "secret", null: false
94
- t.string "identifier", null: false
95
- t.index ["identifier"], name: "index_oauth_clients_on_identifier", unique: true
96
- end
97
-
98
- create_table "redirect_uris", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
99
- t.string "uri", null: false
100
- t.boolean "primary", default: false, null: false
101
- t.uuid "oauth_client_id"
102
- t.index ["oauth_client_id"], name: "index_redirect_uris_on_oauth_client_id"
103
- t.index ["uri", "primary"], name: "index_redirect_uris_on_uri_and_primary", unique: true
104
- end
105
-
106
- create_table "saml_providers", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
107
- t.string "provider", null: false
108
- t.string "domain", null: false
109
- t.string "idp_sso_target_url"
110
- t.text "idp_cert"
111
- t.uuid "enterprise_account_id"
112
- t.uuid "oauth_client_id"
113
- t.index ["domain", "provider"], name: "index_saml_providers_on_domain_and_provider", unique: true
114
- t.index ["enterprise_account_id"], name: "index_saml_providers_on_enterprise_account_id"
115
- t.index ["oauth_client_id"], name: "index_saml_providers_on_oauth_client_id"
116
- end
117
-
118
- create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
119
- t.string "email", null: false
120
- t.string "idp_id", null: false
121
- t.uuid "saml_provider_id"
122
- t.uuid "enterprise_account_id"
123
- t.index ["email", "idp_id"], name: "index_users_on_email_and_idp_id", unique: true
124
- t.index ["enterprise_account_id"], name: "index_users_on_enterprise_account_id"
125
- end
126
-
127
- add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id"
128
- add_foreign_key "oauth_access_grants", "users", column: "resource_owner_id"
129
- add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id"
130
- add_foreign_key "oauth_access_tokens", "users", column: "resource_owner_id"
131
- add_foreign_key "users", "saml_providers"
132
- end
@@ -1,27 +0,0 @@
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