osso 0.0.3.6 → 0.0.3.11

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/pipeline.yml +5 -3
  3. data/Gemfile.lock +5 -1
  4. data/bin/annotate +1 -0
  5. data/db/schema.rb +11 -54
  6. data/lib/osso/db/migrate/20200714223226_add_identity_provider_service_enum.rb +1 -1
  7. data/lib/osso/db/migrate/20200722230116_add_identity_provider_status_enum_and_use_on_identity_providers.rb +15 -0
  8. data/lib/osso/db/migrate/20200723153750_add_missing_timestamps.rb +35 -0
  9. data/lib/osso/db/migrate/20200723162228_drop_unneeded_tables.rb +9 -0
  10. data/lib/osso/graphql/mutation.rb +4 -2
  11. data/lib/osso/graphql/mutations.rb +3 -1
  12. data/lib/osso/graphql/mutations/base_mutation.rb +8 -2
  13. data/lib/osso/graphql/mutations/configure_identity_provider.rb +10 -1
  14. data/lib/osso/graphql/mutations/create_oauth_client.rb +30 -0
  15. data/lib/osso/graphql/mutations/delete_enterprise_account.rb +34 -0
  16. data/lib/osso/graphql/mutations/delete_oauth_client.rb +30 -0
  17. data/lib/osso/graphql/query.rb +4 -1
  18. data/lib/osso/graphql/resolvers/enterprise_accounts.rb +12 -4
  19. data/lib/osso/graphql/resolvers/oauth_clients.rb +1 -1
  20. data/lib/osso/graphql/schema.rb +4 -0
  21. data/lib/osso/graphql/types.rb +2 -0
  22. data/lib/osso/graphql/types/base_connection.rb +15 -0
  23. data/lib/osso/graphql/types/base_object.rb +4 -0
  24. data/lib/osso/graphql/types/enterprise_account.rb +4 -0
  25. data/lib/osso/graphql/types/identity_provider.rb +8 -3
  26. data/lib/osso/graphql/types/identity_provider_status.rb +14 -0
  27. data/lib/osso/graphql/types/oauth_client.rb +13 -1
  28. data/lib/osso/helpers/auth.rb +11 -12
  29. data/lib/osso/models/access_token.rb +18 -0
  30. data/lib/osso/models/authorization_code.rb +20 -0
  31. data/lib/osso/models/enterprise_account.rb +20 -0
  32. data/lib/osso/models/identity_provider.rb +29 -0
  33. data/lib/osso/models/models.rb +2 -0
  34. data/lib/osso/models/oauth_client.rb +17 -1
  35. data/lib/osso/models/redirect_uri.rb +17 -0
  36. data/lib/osso/models/user.rb +22 -0
  37. data/lib/osso/version.rb +1 -1
  38. data/osso-rb.gemspec +1 -0
  39. data/spec/factories/identity_providers.rb +22 -0
  40. data/spec/graphql/mutations/configure_identity_provider_spec.rb +14 -4
  41. data/spec/graphql/mutations/create_oauth_client_spec.rb +55 -0
  42. data/spec/graphql/mutations/delete_enterprise_account_spec.rb +63 -0
  43. data/spec/graphql/mutations/delete_oauth_client_spec.rb +51 -0
  44. data/spec/graphql/query/enterprise_account_spec.rb +1 -1
  45. data/spec/graphql/query/enterprise_accounts_spec.rb +32 -18
  46. data/spec/graphql/query/identity_provider_spec.rb +9 -6
  47. data/spec/graphql/query/{oauth_clients_account_spec.rb → oauth_clients_spec.rb} +2 -0
  48. metadata +30 -8
  49. data/lib/osso/db/migrate/20200328143303_create_oauth_tables.rb +0 -57
  50. data/lib/osso/graphql/mutations/set_identity_provider.rb +0 -27
  51. data/lib/osso/models/saml_provider.rb +0 -49
  52. data/lib/osso/models/saml_providers/azure_saml_provider.rb +0 -22
  53. data/lib/osso/models/saml_providers/okta_saml_provider.rb +0 -23
@@ -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
- identity_provider = Osso::Models::IdentityProvider.find(id)
17
- identity_provider.service = provider
18
- identity_provider.save!
19
- {
20
- identity_provider: identity_provider,
21
- errors: [],
22
- }
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Osso
4
- module Models
5
- # Base class for SAML Providers
6
- class IdentityProvider < ActiveRecord::Base
7
- NAME_FORMAT = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
8
- belongs_to :enterprise_account
9
- belongs_to :oauth_client
10
- has_many :users
11
-
12
- before_create :create_enterprise_account
13
-
14
- # def name
15
- # raise(
16
- # NoMethodError,
17
- # '#name must be defined on each provider specific subclass',
18
- # )
19
- # end
20
-
21
- # def saml_options
22
- # raise(
23
- # NoMethodError,
24
- # '#saml_options must be defined on each provider specific subclass',
25
- # )
26
- # end
27
-
28
- def assertion_consumer_service_url
29
- [
30
- ENV.fetch('BASE_URL'),
31
- 'auth',
32
- 'saml',
33
- id,
34
- 'callback',
35
- ].join('/')
36
- end
37
-
38
- alias acs_url assertion_consumer_service_url
39
-
40
- def create_enterprise_account
41
- return if enterprise_account_id
42
-
43
- self.enterprise_account = Models::EnterpriseAccount.create(
44
- domain: domain,
45
- )
46
- end
47
- end
48
- end
49
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Osso
4
- module Models
5
- # Subclass for Azure / ADFS IDP instances
6
- class AzureSamlProvider < Models::IdentityProvider
7
- def name
8
- 'Azure'
9
- end
10
-
11
- def saml_options
12
- attributes.slice(
13
- 'domain',
14
- 'idp_cert',
15
- 'idp_sso_target_url',
16
- ).merge(
17
- issuer: "id:#{id}",
18
- ).symbolize_keys
19
- end
20
- end
21
- end
22
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Osso
4
- module Models
5
- # Subclass for Okta IDP instances
6
- class OktaSamlProvider < Models::IdentityProvider
7
- def name
8
- 'Okta'
9
- end
10
-
11
- def saml_options
12
- attributes.slice(
13
- 'domain',
14
- 'idp_cert',
15
- 'idp_sso_target_url',
16
- ).merge(
17
- issuer: id,
18
- name_identifier_format: NAME_FORMAT,
19
- ).symbolize_keys
20
- end
21
- end
22
- end
23
- end