osso 0.0.3.1 → 0.0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/pipeline.yml +4 -1
  3. data/.rubocop.yml +1 -2
  4. data/Gemfile.lock +3 -1
  5. data/bin/console +4 -3
  6. data/config/database.yml +2 -2
  7. data/db/schema.rb +133 -1
  8. data/lib/osso.rb +2 -0
  9. data/lib/osso/db/migrate/20200328143305_create_identity_providers.rb +12 -0
  10. data/lib/osso/db/migrate/20200411184535_add_provider_id_to_users.rb +2 -2
  11. data/lib/osso/db/migrate/20200411192645_create_enterprise_accounts.rb +1 -1
  12. data/lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_accounts_and_identity_providers.rb +6 -0
  13. data/lib/osso/db/migrate/20200714223226_add_identity_provider_service_enum.rb +17 -0
  14. data/lib/osso/db/migrate/20200715154211_rename_idp_fields_on_identity_provider_to_sso.rb +6 -0
  15. data/lib/osso/db/migrate/20200715205801_add_name_to_enterprise_account.rb +5 -0
  16. data/lib/osso/graphql/mutation.rb +10 -5
  17. data/lib/osso/graphql/mutations.rb +5 -2
  18. data/lib/osso/graphql/mutations/base_mutation.rb +29 -14
  19. data/lib/osso/graphql/mutations/configure_identity_provider.rb +19 -18
  20. data/lib/osso/graphql/mutations/create_enterprise_account.rb +25 -0
  21. data/lib/osso/graphql/mutations/create_identity_provider.rb +22 -16
  22. data/lib/osso/graphql/mutations/set_identity_provider.rb +27 -0
  23. data/lib/osso/graphql/query.rb +19 -22
  24. data/lib/osso/graphql/resolvers.rb +5 -1
  25. data/lib/osso/graphql/resolvers/enterprise_account.rb +16 -12
  26. data/lib/osso/graphql/resolvers/enterprise_accounts.rb +10 -6
  27. data/lib/osso/graphql/resolvers/oauth_clients.rb +9 -5
  28. data/lib/osso/graphql/schema.rb +23 -19
  29. data/lib/osso/graphql/types.rb +4 -1
  30. data/lib/osso/graphql/types/base_enum.rb +6 -2
  31. data/lib/osso/graphql/types/base_input_object.rb +10 -0
  32. data/lib/osso/graphql/types/base_object.rb +6 -2
  33. data/lib/osso/graphql/types/enterprise_account.rb +19 -19
  34. data/lib/osso/graphql/types/identity_provider.rb +19 -27
  35. data/lib/osso/graphql/types/identity_provider_service.rb +8 -4
  36. data/lib/osso/graphql/types/oauth_client.rb +13 -9
  37. data/lib/osso/graphql/types/user.rb +10 -5
  38. data/lib/osso/helpers/auth.rb +53 -49
  39. data/lib/osso/helpers/helpers.rb +3 -1
  40. data/lib/osso/lib/app_config.rb +1 -1
  41. data/lib/osso/lib/route_map.rb +28 -0
  42. data/lib/osso/models/enterprise_account.rb +4 -4
  43. data/lib/osso/models/identity_provider.rb +48 -0
  44. data/lib/osso/models/models.rb +1 -1
  45. data/lib/osso/models/oauth_client.rb +2 -2
  46. data/lib/osso/models/saml_provider.rb +13 -16
  47. data/lib/osso/models/saml_providers/azure_saml_provider.rb +2 -2
  48. data/lib/osso/models/saml_providers/okta_saml_provider.rb +1 -1
  49. data/lib/osso/models/user.rb +3 -3
  50. data/lib/osso/routes/admin.rb +18 -15
  51. data/lib/osso/routes/auth.rb +30 -27
  52. data/lib/osso/routes/oauth.rb +50 -45
  53. data/lib/osso/version.rb +1 -1
  54. data/osso-rb.gemspec +3 -3
  55. data/spec/factories/enterprise_account.rb +5 -4
  56. data/spec/factories/identity_providers.rb +49 -0
  57. data/spec/factories/user.rb +1 -1
  58. data/spec/graphql/mutations/configure_identity_provider_spec.rb +65 -0
  59. data/spec/graphql/mutations/create_enterprise_account_spec.rb +68 -0
  60. data/spec/graphql/mutations/create_identity_provider_spec.rb +104 -0
  61. data/spec/graphql/query/enterprise_account_spec.rb +68 -0
  62. data/spec/graphql/query/enterprise_accounts_spec.rb +44 -0
  63. data/spec/graphql/query/identity_provider_spec.rb +62 -0
  64. data/spec/graphql/query/oauth_clients_account_spec.rb +48 -0
  65. data/spec/models/azure_saml_provider_spec.rb +14 -14
  66. data/spec/models/identity_provider_spec.rb +17 -0
  67. data/spec/models/okta_saml_provider_spec.rb +15 -15
  68. data/spec/routes/admin_spec.rb +2 -0
  69. data/spec/routes/auth_spec.rb +9 -9
  70. data/spec/routes/oauth_spec.rb +1 -1
  71. data/spec/spec_helper.rb +4 -5
  72. data/spec/support/spec_app.rb +9 -0
  73. data/spec/support/views/{public/index.erb → admin.erb} +0 -0
  74. metadata +37 -13
  75. data/lib/osso/db/migrate/20200411144528_create_saml_providers.rb +0 -13
  76. data/lib/osso/db/migrate/20200413153029_add_oauth_client_reference_to_saml_providers.rb +0 -5
  77. data/lib/osso/db/migrate/20200501203026_drop_null_constraints_from_saml_provider.rb +0 -7
  78. data/lib/osso/db/migrate/20200501204047_drop_acs_url.rb +0 -5
  79. data/lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_account.rb +0 -5
  80. data/lib/osso/db/migrate/20200601131227_drop_null_constraint_from_saml_providers_provider.rb +0 -7
  81. data/lib/osso/db/schema.rb +0 -132
  82. data/lib/osso/graphql/mutations/set_saml_provider.rb +0 -23
  83. data/spec/factories/saml_providers.rb +0 -46
  84. 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.1
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-09 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
@@ -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
@@ -225,26 +239,25 @@ files:
225
239
  - lib/osso/db/migrate/20190909230109_enable_uuid.rb
226
240
  - lib/osso/db/migrate/20200328135750_create_users.rb
227
241
  - lib/osso/db/migrate/20200328143303_create_oauth_tables.rb
228
- - lib/osso/db/migrate/20200411144528_create_saml_providers.rb
242
+ - lib/osso/db/migrate/20200328143305_create_identity_providers.rb
229
243
  - lib/osso/db/migrate/20200411184535_add_provider_id_to_users.rb
230
244
  - lib/osso/db/migrate/20200411192645_create_enterprise_accounts.rb
231
245
  - lib/osso/db/migrate/20200413132407_add_oauth_clients.rb
232
246
  - lib/osso/db/migrate/20200413142511_create_authorization_codes.rb
233
- - lib/osso/db/migrate/20200413153029_add_oauth_client_reference_to_saml_providers.rb
234
247
  - lib/osso/db/migrate/20200413163451_create_access_tokens.rb
235
- - lib/osso/db/migrate/20200501203026_drop_null_constraints_from_saml_provider.rb
236
- - lib/osso/db/migrate/20200501204047_drop_acs_url.rb
237
248
  - lib/osso/db/migrate/20200502120616_create_redirect_uris_and_drop_from_oauth_clients.rb
238
- - lib/osso/db/migrate/20200502135008_add_oauth_client_id_to_enterprise_account.rb
239
- - lib/osso/db/migrate/20200601131227_drop_null_constraint_from_saml_providers_provider.rb
240
- - 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
241
253
  - lib/osso/graphql/.DS_Store
242
254
  - lib/osso/graphql/mutation.rb
243
255
  - lib/osso/graphql/mutations.rb
244
256
  - lib/osso/graphql/mutations/base_mutation.rb
245
257
  - lib/osso/graphql/mutations/configure_identity_provider.rb
258
+ - lib/osso/graphql/mutations/create_enterprise_account.rb
246
259
  - lib/osso/graphql/mutations/create_identity_provider.rb
247
- - lib/osso/graphql/mutations/set_saml_provider.rb
260
+ - lib/osso/graphql/mutations/set_identity_provider.rb
248
261
  - lib/osso/graphql/query.rb
249
262
  - lib/osso/graphql/resolvers.rb
250
263
  - lib/osso/graphql/resolvers/enterprise_account.rb
@@ -253,6 +266,7 @@ files:
253
266
  - lib/osso/graphql/schema.rb
254
267
  - lib/osso/graphql/types.rb
255
268
  - lib/osso/graphql/types/base_enum.rb
269
+ - lib/osso/graphql/types/base_input_object.rb
256
270
  - lib/osso/graphql/types/base_object.rb
257
271
  - lib/osso/graphql/types/enterprise_account.rb
258
272
  - lib/osso/graphql/types/identity_provider.rb
@@ -263,9 +277,11 @@ files:
263
277
  - lib/osso/helpers/helpers.rb
264
278
  - lib/osso/lib/app_config.rb
265
279
  - lib/osso/lib/oauth2_token.rb
280
+ - lib/osso/lib/route_map.rb
266
281
  - lib/osso/models/access_token.rb
267
282
  - lib/osso/models/authorization_code.rb
268
283
  - lib/osso/models/enterprise_account.rb
284
+ - lib/osso/models/identity_provider.rb
269
285
  - lib/osso/models/models.rb
270
286
  - lib/osso/models/oauth_client.rb
271
287
  - lib/osso/models/redirect_uri.rb
@@ -285,19 +301,27 @@ files:
285
301
  - osso-rb.gemspec
286
302
  - spec/factories/authorization_code.rb
287
303
  - spec/factories/enterprise_account.rb
304
+ - spec/factories/identity_providers.rb
288
305
  - spec/factories/oauth_client.rb
289
306
  - spec/factories/redirect_uri.rb
290
- - spec/factories/saml_providers.rb
291
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
292
315
  - spec/models/azure_saml_provider_spec.rb
316
+ - spec/models/identity_provider_spec.rb
293
317
  - spec/models/okta_saml_provider_spec.rb
294
- - spec/models/saml_provider_spec.rb
295
318
  - spec/routes/admin_spec.rb
296
319
  - spec/routes/app_spec.rb
297
320
  - spec/routes/auth_spec.rb
298
321
  - spec/routes/oauth_spec.rb
299
322
  - spec/spec_helper.rb
300
- - spec/support/views/public/index.erb
323
+ - spec/support/spec_app.rb
324
+ - spec/support/views/admin.erb
301
325
  homepage: https://github.com/enterprise-oss/osso-rb
302
326
  licenses:
303
327
  - MIT
@@ -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,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
@@ -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