osso 0.0.3.5 → 0.0.3.6

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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/pipeline.yml +4 -1
  3. data/Gemfile.lock +1 -1
  4. data/config/database.yml +2 -2
  5. data/db/schema.rb +133 -1
  6. data/lib/osso/db/migrate/20200328143305_create_identity_providers.rb +12 -0
  7. data/lib/osso/db/migrate/20200411184535_add_provider_id_to_users.rb +2 -2
  8. data/lib/osso/db/migrate/20200411192645_create_enterprise_accounts.rb +1 -1
  9. data/lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_accounts_and_identity_providers.rb +6 -0
  10. data/lib/osso/db/migrate/20200714223226_add_identity_provider_service_enum.rb +17 -0
  11. data/lib/osso/db/migrate/20200715154211_rename_idp_fields_on_identity_provider_to_sso.rb +6 -0
  12. data/lib/osso/db/migrate/20200715205801_add_name_to_enterprise_account.rb +5 -0
  13. data/lib/osso/graphql/mutation.rb +2 -1
  14. data/lib/osso/graphql/mutations.rb +2 -1
  15. data/lib/osso/graphql/mutations/base_mutation.rb +18 -7
  16. data/lib/osso/graphql/mutations/configure_identity_provider.rb +10 -13
  17. data/lib/osso/graphql/mutations/create_enterprise_account.rb +25 -0
  18. data/lib/osso/graphql/mutations/create_identity_provider.rb +9 -7
  19. data/lib/osso/graphql/mutations/{set_saml_provider.rb → set_identity_provider.rb} +4 -4
  20. data/lib/osso/graphql/query.rb +2 -2
  21. data/lib/osso/graphql/resolvers/oauth_clients.rb +1 -1
  22. data/lib/osso/graphql/schema.rb +1 -1
  23. data/lib/osso/graphql/types.rb +1 -0
  24. data/lib/osso/graphql/types/base_input_object.rb +10 -0
  25. data/lib/osso/graphql/types/enterprise_account.rb +1 -5
  26. data/lib/osso/graphql/types/identity_provider.rb +1 -13
  27. data/lib/osso/lib/app_config.rb +1 -1
  28. data/lib/osso/models/enterprise_account.rb +4 -4
  29. data/lib/osso/models/identity_provider.rb +48 -0
  30. data/lib/osso/models/models.rb +1 -1
  31. data/lib/osso/models/oauth_client.rb +1 -1
  32. data/lib/osso/models/saml_provider.rb +13 -16
  33. data/lib/osso/models/saml_providers/azure_saml_provider.rb +1 -1
  34. data/lib/osso/models/saml_providers/okta_saml_provider.rb +1 -1
  35. data/lib/osso/models/user.rb +3 -3
  36. data/lib/osso/routes/auth.rb +4 -4
  37. data/lib/osso/routes/oauth.rb +1 -1
  38. data/lib/osso/version.rb +1 -1
  39. data/spec/factories/enterprise_account.rb +5 -4
  40. data/spec/factories/identity_providers.rb +49 -0
  41. data/spec/factories/user.rb +1 -1
  42. data/spec/graphql/mutations/configure_identity_provider_spec.rb +65 -0
  43. data/spec/graphql/mutations/create_enterprise_account_spec.rb +68 -0
  44. data/spec/graphql/mutations/create_identity_provider_spec.rb +104 -0
  45. data/spec/graphql/query/enterprise_account_spec.rb +68 -0
  46. data/spec/graphql/query/enterprise_accounts_spec.rb +44 -0
  47. data/spec/graphql/query/identity_provider_spec.rb +62 -0
  48. data/spec/graphql/query/oauth_clients_account_spec.rb +48 -0
  49. data/spec/models/azure_saml_provider_spec.rb +14 -14
  50. data/spec/models/identity_provider_spec.rb +17 -0
  51. data/spec/models/okta_saml_provider_spec.rb +15 -15
  52. data/spec/routes/auth_spec.rb +9 -9
  53. data/spec/routes/oauth_spec.rb +1 -1
  54. data/spec/spec_helper.rb +1 -0
  55. metadata +20 -12
  56. data/lib/osso/db/migrate/20200411144528_create_saml_providers.rb +0 -13
  57. data/lib/osso/db/migrate/20200413153029_add_oauth_client_reference_to_saml_providers.rb +0 -5
  58. data/lib/osso/db/migrate/20200501203026_drop_null_constraints_from_saml_provider.rb +0 -7
  59. data/lib/osso/db/migrate/20200501204047_drop_acs_url.rb +0 -5
  60. data/lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_account.rb +0 -5
  61. data/lib/osso/db/migrate/20200601131227_drop_null_constraint_from_saml_providers_provider.rb +0 -7
  62. data/lib/osso/db/schema.rb +0 -132
  63. data/spec/factories/saml_providers.rb +0 -46
  64. data/spec/models/saml_provider_spec.rb +0 -31
@@ -2,19 +2,19 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe Osso::Models::OktaSamlProvider do
6
- subject { create(:okta_saml_provider) }
5
+ # describe Osso::Models::OktaSamlProvider do
6
+ # subject { create(:okta_identity_provider) }
7
7
 
8
- describe '#saml_options' do
9
- it 'returns the required args' do
10
- expect(subject.saml_options).
11
- to match(
12
- domain: subject.domain,
13
- idp_cert: subject.idp_cert,
14
- idp_sso_target_url: subject.idp_sso_target_url,
15
- issuer: subject.id,
16
- name_identifier_format: described_class::NAME_FORMAT,
17
- )
18
- end
19
- end
20
- end
8
+ # describe '#saml_options' do
9
+ # it 'returns the required args' do
10
+ # expect(subject.saml_options).
11
+ # to match(
12
+ # domain: subject.domain,
13
+ # idp_cert: subject.idp_cert,
14
+ # idp_sso_target_url: subject.idp_sso_target_url,
15
+ # issuer: subject.id,
16
+ # name_identifier_format: described_class::NAME_FORMAT,
17
+ # )
18
+ # end
19
+ # end
20
+ # end
@@ -6,7 +6,7 @@ describe Osso::Auth do
6
6
  describe 'post /auth/saml/:uuid/callback' do
7
7
  describe 'for an Okta SAML provider' do
8
8
  let(:enterprise) { create(:enterprise_with_okta) }
9
- let(:okta_provider) { enterprise.saml_providers.first }
9
+ let(:okta_provider) { enterprise.identity_providers.first }
10
10
 
11
11
  describe "on the user's first authentication" do
12
12
  it 'creates a user' do
@@ -18,7 +18,7 @@ describe Osso::Auth do
18
18
  nil,
19
19
  {
20
20
  'omniauth.auth' => OmniAuth.config.mock_auth[:saml],
21
- 'saml_provider' => okta_provider,
21
+ 'identity_provider' => okta_provider,
22
22
  },
23
23
  )
24
24
  end.to change { Osso::Models::User.count }.by(1)
@@ -33,7 +33,7 @@ describe Osso::Auth do
33
33
  nil,
34
34
  {
35
35
  'omniauth.auth' => OmniAuth.config.mock_auth[:saml],
36
- 'saml_provider' => okta_provider,
36
+ 'identity_provider' => okta_provider,
37
37
  },
38
38
  )
39
39
  end.to change { Osso::Models::AuthorizationCode.count }.by(1)
@@ -42,8 +42,8 @@ describe Osso::Auth do
42
42
 
43
43
  describe 'on subsequent authentications' do
44
44
  let!(:enterprise) { create(:enterprise_with_okta) }
45
- let!(:okta_provider) { enterprise.saml_providers.first }
46
- let(:user) { create(:user, saml_provider_id: okta_provider.id) }
45
+ let!(:okta_provider) { enterprise.identity_providers.first }
46
+ let(:user) { create(:user, identity_provider_id: okta_provider.id) }
47
47
 
48
48
  before do
49
49
  mock_saml_omniauth(email: user.email, id: user.idp_id)
@@ -56,7 +56,7 @@ describe Osso::Auth do
56
56
  nil,
57
57
  {
58
58
  'omniauth.auth' => OmniAuth.config.mock_auth[:saml],
59
- 'saml_provider' => okta_provider,
59
+ 'identity_provider' => okta_provider,
60
60
  },
61
61
  )
62
62
  end.to_not(change { Osso::Models::User.count })
@@ -78,7 +78,7 @@ describe Osso::Auth do
78
78
  nil,
79
79
  {
80
80
  'omniauth.auth' => OmniAuth.config.mock_auth[:saml],
81
- 'saml_provider' => azure_provider,
81
+ 'identity_provider' => azure_provider,
82
82
  },
83
83
  )
84
84
  end.to change { Osso::Models::User.count }.by(1)
@@ -88,7 +88,7 @@ describe Osso::Auth do
88
88
  describe 'on subsequent authentications' do
89
89
  let!(:enterprise) { create(:enterprise_with_azure) }
90
90
  let!(:azure_provider) { enterprise.provider }
91
- let(:user) { create(:user, saml_provider_id: azure_provider.id) }
91
+ let(:user) { create(:user, identity_provider_id: azure_provider.id) }
92
92
 
93
93
  before do
94
94
  mock_saml_omniauth(email: user.email, id: user.idp_id)
@@ -101,7 +101,7 @@ describe Osso::Auth do
101
101
  nil,
102
102
  {
103
103
  'omniauth.auth' => OmniAuth.config.mock_auth[:saml],
104
- 'saml_provider' => azure_provider,
104
+ 'identity_provider' => azure_provider,
105
105
  },
106
106
  )
107
107
  end.to_not(change { Osso::Models::User.count })
@@ -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,6 +11,7 @@ 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
 
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.5
4
+ version: 0.0.3.6
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-10 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -239,26 +239,25 @@ files:
239
239
  - lib/osso/db/migrate/20190909230109_enable_uuid.rb
240
240
  - lib/osso/db/migrate/20200328135750_create_users.rb
241
241
  - lib/osso/db/migrate/20200328143303_create_oauth_tables.rb
242
- - lib/osso/db/migrate/20200411144528_create_saml_providers.rb
242
+ - lib/osso/db/migrate/20200328143305_create_identity_providers.rb
243
243
  - lib/osso/db/migrate/20200411184535_add_provider_id_to_users.rb
244
244
  - lib/osso/db/migrate/20200411192645_create_enterprise_accounts.rb
245
245
  - lib/osso/db/migrate/20200413132407_add_oauth_clients.rb
246
246
  - lib/osso/db/migrate/20200413142511_create_authorization_codes.rb
247
- - lib/osso/db/migrate/20200413153029_add_oauth_client_reference_to_saml_providers.rb
248
247
  - 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
248
  - 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
249
+ - lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_accounts_and_identity_providers.rb
250
+ - lib/osso/db/migrate/20200714223226_add_identity_provider_service_enum.rb
251
+ - lib/osso/db/migrate/20200715154211_rename_idp_fields_on_identity_provider_to_sso.rb
252
+ - lib/osso/db/migrate/20200715205801_add_name_to_enterprise_account.rb
255
253
  - lib/osso/graphql/.DS_Store
256
254
  - lib/osso/graphql/mutation.rb
257
255
  - lib/osso/graphql/mutations.rb
258
256
  - lib/osso/graphql/mutations/base_mutation.rb
259
257
  - lib/osso/graphql/mutations/configure_identity_provider.rb
258
+ - lib/osso/graphql/mutations/create_enterprise_account.rb
260
259
  - lib/osso/graphql/mutations/create_identity_provider.rb
261
- - lib/osso/graphql/mutations/set_saml_provider.rb
260
+ - lib/osso/graphql/mutations/set_identity_provider.rb
262
261
  - lib/osso/graphql/query.rb
263
262
  - lib/osso/graphql/resolvers.rb
264
263
  - lib/osso/graphql/resolvers/enterprise_account.rb
@@ -267,6 +266,7 @@ files:
267
266
  - lib/osso/graphql/schema.rb
268
267
  - lib/osso/graphql/types.rb
269
268
  - lib/osso/graphql/types/base_enum.rb
269
+ - lib/osso/graphql/types/base_input_object.rb
270
270
  - lib/osso/graphql/types/base_object.rb
271
271
  - lib/osso/graphql/types/enterprise_account.rb
272
272
  - lib/osso/graphql/types/identity_provider.rb
@@ -281,6 +281,7 @@ files:
281
281
  - lib/osso/models/access_token.rb
282
282
  - lib/osso/models/authorization_code.rb
283
283
  - lib/osso/models/enterprise_account.rb
284
+ - lib/osso/models/identity_provider.rb
284
285
  - lib/osso/models/models.rb
285
286
  - lib/osso/models/oauth_client.rb
286
287
  - lib/osso/models/redirect_uri.rb
@@ -300,13 +301,20 @@ files:
300
301
  - osso-rb.gemspec
301
302
  - spec/factories/authorization_code.rb
302
303
  - spec/factories/enterprise_account.rb
304
+ - spec/factories/identity_providers.rb
303
305
  - spec/factories/oauth_client.rb
304
306
  - spec/factories/redirect_uri.rb
305
- - spec/factories/saml_providers.rb
306
307
  - spec/factories/user.rb
308
+ - spec/graphql/mutations/configure_identity_provider_spec.rb
309
+ - spec/graphql/mutations/create_enterprise_account_spec.rb
310
+ - spec/graphql/mutations/create_identity_provider_spec.rb
311
+ - spec/graphql/query/enterprise_account_spec.rb
312
+ - spec/graphql/query/enterprise_accounts_spec.rb
313
+ - spec/graphql/query/identity_provider_spec.rb
314
+ - spec/graphql/query/oauth_clients_account_spec.rb
307
315
  - spec/models/azure_saml_provider_spec.rb
316
+ - spec/models/identity_provider_spec.rb
308
317
  - spec/models/okta_saml_provider_spec.rb
309
- - spec/models/saml_provider_spec.rb
310
318
  - spec/routes/admin_spec.rb
311
319
  - spec/routes/app_spec.rb
312
320
  - spec/routes/auth_spec.rb
@@ -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,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- FactoryBot.define do
4
- factory :saml_provider, class: Osso::Models::SamlProvider do
5
- id { SecureRandom.uuid }
6
- domain { Faker::Internet.domain_name }
7
- oauth_client
8
- idp_cert do
9
- <<~CERT
10
- -----BEGIN CERTIFICATE-----
11
- MIIDpDCCAoygAwIBAgIGAXEiD4LlMA0GCSqGSIb3DQEBCwUAMIGSMQswCQYDVQQGEwJVUzETMBEG
12
- A1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU
13
- MBIGA1UECwwLU1NPUHJvdmlkZXIxEzARBgNVBAMMCmRldi0xNjIwMjQxHDAaBgkqhkiG9w0BCQEW
14
- DWluZm9Ab2t0YS5jb20wHhcNMjAwMzI4MTY1MTU0WhcNMzAwMzI4MTY1MjU0WjCBkjELMAkGA1UE
15
- BhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDTALBgNV
16
- BAoMBE9rdGExFDASBgNVBAsMC1NTT1Byb3ZpZGVyMRMwEQYDVQQDDApkZXYtMTYyMDI0MRwwGgYJ
17
- KoZIhvcNAQkBFg1pbmZvQG9rdGEuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
18
- wsnP4UTfv3bxR5Jh0at51Dqjj+fKxFznzFW3XA5NbF2SlRLjeYcvj3+47TC0eP6xOsLWfnvdnx4v
19
- dd9Ufn7jDCo5pL3JykMVEh2I0szF3RLC+a532ArcwgU9Px48+rWVwPkASS7l4NHAM4+gOBHJMQt2
20
- AMohPT0kU41P8BEPzfwhNyiEXR66JNZIJUE8fM3Vpgnxm/VSwYzJf0NfOyfxv8JczF0zkDbpE7Tk
21
- 3Ww/PFFLoMxWzanWGJQ+blnhv6UV6H4fcfAbcwAplOdIVHjS2ghYBvYNGahuFxjia0+6csyZGrt8
22
- H4XmR5Dr+jXY5K1b1VOA0k19/FCnHHN/smn25wIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBgD9NE
23
- 4OCuR1+vucV8S1T6XXIL2hB7bXBAZEVHZ1aErRzktgXAMgVwG267vIkD5VOXBiTy9yNU5LK6G3k2
24
- zewU190sL1dMfyPnoVZyn94nvwe9A+on0tmZdmk00xirKk3FJdacnZNE9Dl/afIrcNf6xAm0WsU9
25
- kbMiRwwvjO4TAiygDQzbrRC8ZfmT3hpBa3aTUzAccrvEQcgarLk4r7UjXP7a2mCN3UIIh+snN2Ms
26
- vXHL0r6fM3xbniz+5lleWtPFw73yySBc8znkWZ4Tn8Lh0r6o5nCRYbr2REUB7ZIfiIyBbZxIp4kv
27
- a+habbnQDFiNVzEd8OPXHh4EqLxOPDRW
28
- -----END CERTIFICATE-----
29
- CERT
30
- end
31
-
32
- factory :okta_saml_provider, parent: :saml_provider, class: Osso::Models::OktaSamlProvider do
33
- provider { 'Osso::Models::OktaSamlProvider' }
34
- idp_sso_target_url do
35
- 'https://dev-162024.okta.com/app/vcardmedev162024_rubydemo2_1/exk51326b3U1941Hf4x6/sso/saml'
36
- end
37
- end
38
-
39
- factory :azure_saml_provider, parent: :saml_provider, class: Osso::Models::AzureSamlProvider do
40
- provider { 'Osso::Models::AzureSamlProvider' }
41
- idp_sso_target_url do
42
- 'https://login.microsoftonline.com/0af6c610-c40c-4683-9ea4-f25e509b8172/saml2'
43
- end
44
- end
45
- end
46
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Osso::Models::SamlProvider do
6
- subject { create(:okta_saml_provider) }
7
-
8
- describe '.create' do
9
- it 'creates an enterprise account' do
10
- domain = Faker::Internet.domain_name
11
-
12
- provider = described_class.create(
13
- domain: domain,
14
- provider: 'Osso::Models::OktaSamlProvider',
15
- )
16
-
17
- expect(provider.enterprise_account).to be_a(Osso::Models::EnterpriseAccount)
18
- expect(provider.enterprise_account.domain).to eq(domain)
19
- end
20
- end
21
-
22
- describe '#assertion_consumer_service_url' do
23
- it 'returns the expected URI' do
24
- ENV['BASE_URL'] = 'https://example.com'
25
-
26
- expect(subject.assertion_consumer_service_url).to eq(
27
- "https://example.com/auth/saml/#{subject.id}/callback",
28
- )
29
- end
30
- end
31
- end