osso 0.0.3.12 → 0.0.3.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/pipeline.yml +8 -1
  3. data/.rubocop.yml +1 -0
  4. data/Gemfile.lock +2 -2
  5. data/bin/publish +18 -0
  6. data/lib/osso/graphql/mutation.rb +7 -3
  7. data/lib/osso/graphql/mutations.rb +1 -3
  8. data/lib/osso/graphql/mutations/base_mutation.rb +18 -5
  9. data/lib/osso/graphql/mutations/configure_identity_provider.rb +8 -10
  10. data/lib/osso/graphql/mutations/create_enterprise_account.rb +2 -0
  11. data/lib/osso/graphql/mutations/create_identity_provider.rb +14 -5
  12. data/lib/osso/graphql/mutations/create_oauth_client.rb +1 -3
  13. data/lib/osso/graphql/mutations/delete_enterprise_account.rb +9 -11
  14. data/lib/osso/graphql/mutations/delete_oauth_client.rb +1 -3
  15. data/lib/osso/graphql/mutations/regenerate_oauth_credentials.rb +3 -5
  16. data/lib/osso/graphql/mutations/set_redirect_uris.rb +52 -0
  17. data/lib/osso/graphql/query.rb +7 -0
  18. data/lib/osso/graphql/resolvers.rb +1 -0
  19. data/lib/osso/graphql/resolvers/base_resolver.rb +21 -0
  20. data/lib/osso/graphql/resolvers/enterprise_account.rb +1 -11
  21. data/lib/osso/graphql/resolvers/enterprise_accounts.rb +2 -2
  22. data/lib/osso/graphql/resolvers/oauth_clients.rb +2 -2
  23. data/lib/osso/graphql/types.rb +2 -1
  24. data/lib/osso/graphql/types/admin_user.rb +22 -0
  25. data/lib/osso/graphql/types/base_object.rb +22 -0
  26. data/lib/osso/graphql/types/enterprise_account.rb +0 -5
  27. data/lib/osso/graphql/types/identity_provider.rb +0 -6
  28. data/lib/osso/graphql/types/oauth_client.rb +2 -4
  29. data/lib/osso/graphql/types/redirect_uri.rb +2 -4
  30. data/lib/osso/graphql/types/redirect_uri_input.rb +16 -0
  31. data/lib/osso/helpers/auth.rb +34 -15
  32. data/lib/osso/lib/route_map.rb +2 -2
  33. data/lib/osso/models/identity_provider.rb +6 -12
  34. data/lib/osso/models/oauth_client.rb +5 -0
  35. data/lib/osso/models/redirect_uri.rb +0 -11
  36. data/lib/osso/routes/admin.rb +2 -2
  37. data/lib/osso/routes/auth.rb +29 -12
  38. data/lib/osso/routes/oauth.rb +25 -18
  39. data/lib/osso/version.rb +1 -1
  40. data/spec/graphql/mutations/configure_identity_provider_spec.rb +17 -4
  41. data/spec/graphql/mutations/create_enterprise_account_spec.rb +13 -4
  42. data/spec/graphql/mutations/create_identity_provider_spec.rb +18 -6
  43. data/spec/graphql/mutations/create_oauth_client_spec.rb +10 -3
  44. data/spec/graphql/mutations/delete_enterprise_account_spec.rb +18 -4
  45. data/spec/graphql/mutations/delete_oauth_client_spec.rb +8 -4
  46. data/spec/graphql/query/enterprise_account_spec.rb +21 -6
  47. data/spec/graphql/query/enterprise_accounts_spec.rb +4 -2
  48. data/spec/graphql/query/identity_provider_spec.rb +16 -6
  49. data/spec/graphql/query/oauth_clients_spec.rb +10 -7
  50. data/spec/models/identity_provider_spec.rb +12 -0
  51. data/spec/routes/auth_spec.rb +18 -0
  52. data/spec/routes/oauth_spec.rb +5 -2
  53. data/spec/support/views/error.erb +0 -0
  54. metadata +12 -9
  55. data/lib/osso/graphql/mutations/add_redirect_uris_to_oauth_client.rb +0 -39
  56. data/lib/osso/graphql/mutations/delete_redirect_uri.rb +0 -38
  57. data/lib/osso/graphql/mutations/mark_redirect_uri_primary.rb +0 -34
  58. data/lib/osso/graphql/types/user.rb +0 -17
@@ -8,7 +8,10 @@ describe Osso::Oauth do
8
8
  describe 'get /oauth/authorize' do
9
9
  describe 'with a valid client ID and redirect URI' do
10
10
  describe 'for a domain that does not belong to an enterprise' do
11
- it '404s' do
11
+ # TODO: better error handling and test
12
+ it 'renders an error page' do
13
+ described_class.set(:views, spec_views)
14
+
12
15
  create(:enterprise_with_okta, domain: 'foo.com')
13
16
 
14
17
  get(
@@ -19,7 +22,7 @@ describe Osso::Oauth do
19
22
  redirect_uri: client.redirect_uri_values.sample,
20
23
  )
21
24
 
22
- expect(last_response.status).to eq(404)
25
+ expect(last_response.status).to eq(200)
23
26
  end
24
27
  end
25
28
 
File without changes
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.12
4
+ version: 0.0.3.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Bauch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-12 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -226,6 +226,7 @@ email:
226
226
  executables:
227
227
  - annotate
228
228
  - console
229
+ - publish
229
230
  - setup
230
231
  extensions: []
231
232
  extra_rdoc_files: []
@@ -246,6 +247,7 @@ files:
246
247
  - Rakefile
247
248
  - bin/annotate
248
249
  - bin/console
250
+ - bin/publish
249
251
  - bin/setup
250
252
  - config/database.yml
251
253
  - db/schema.rb
@@ -271,7 +273,6 @@ files:
271
273
  - lib/osso/graphql/.DS_Store
272
274
  - lib/osso/graphql/mutation.rb
273
275
  - lib/osso/graphql/mutations.rb
274
- - lib/osso/graphql/mutations/add_redirect_uris_to_oauth_client.rb
275
276
  - lib/osso/graphql/mutations/base_mutation.rb
276
277
  - lib/osso/graphql/mutations/configure_identity_provider.rb
277
278
  - lib/osso/graphql/mutations/create_enterprise_account.rb
@@ -279,16 +280,17 @@ files:
279
280
  - lib/osso/graphql/mutations/create_oauth_client.rb
280
281
  - lib/osso/graphql/mutations/delete_enterprise_account.rb
281
282
  - lib/osso/graphql/mutations/delete_oauth_client.rb
282
- - lib/osso/graphql/mutations/delete_redirect_uri.rb
283
- - lib/osso/graphql/mutations/mark_redirect_uri_primary.rb
284
283
  - lib/osso/graphql/mutations/regenerate_oauth_credentials.rb
284
+ - lib/osso/graphql/mutations/set_redirect_uris.rb
285
285
  - lib/osso/graphql/query.rb
286
286
  - lib/osso/graphql/resolvers.rb
287
+ - lib/osso/graphql/resolvers/base_resolver.rb
287
288
  - lib/osso/graphql/resolvers/enterprise_account.rb
288
289
  - lib/osso/graphql/resolvers/enterprise_accounts.rb
289
290
  - lib/osso/graphql/resolvers/oauth_clients.rb
290
291
  - lib/osso/graphql/schema.rb
291
292
  - lib/osso/graphql/types.rb
293
+ - lib/osso/graphql/types/admin_user.rb
292
294
  - lib/osso/graphql/types/base_connection.rb
293
295
  - lib/osso/graphql/types/base_enum.rb
294
296
  - lib/osso/graphql/types/base_input_object.rb
@@ -299,7 +301,7 @@ files:
299
301
  - lib/osso/graphql/types/identity_provider_status.rb
300
302
  - lib/osso/graphql/types/oauth_client.rb
301
303
  - lib/osso/graphql/types/redirect_uri.rb
302
- - lib/osso/graphql/types/user.rb
304
+ - lib/osso/graphql/types/redirect_uri_input.rb
303
305
  - lib/osso/helpers/auth.rb
304
306
  - lib/osso/helpers/helpers.rb
305
307
  - lib/osso/lib/app_config.rb
@@ -349,11 +351,12 @@ files:
349
351
  - spec/spec_helper.rb
350
352
  - spec/support/spec_app.rb
351
353
  - spec/support/views/admin.erb
354
+ - spec/support/views/error.erb
352
355
  homepage: https://github.com/enterprise-oss/osso-rb
353
356
  licenses:
354
357
  - MIT
355
358
  metadata: {}
356
- post_install_message:
359
+ post_install_message:
357
360
  rdoc_options: []
358
361
  require_paths:
359
362
  - lib
@@ -369,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
372
  version: '0'
370
373
  requirements: []
371
374
  rubygems_version: 3.0.3
372
- signing_key:
375
+ signing_key:
373
376
  specification_version: 4
374
377
  summary: Main functionality for Osso
375
378
  test_files: []
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Osso
4
- module GraphQL
5
- module Mutations
6
- class AddRedirectUrisToOauthClient < BaseMutation
7
- null false
8
-
9
- argument :oauth_client_id, ID, required: true
10
- argument :uris, [String], required: true
11
-
12
- field :oauth_client, Types::OauthClient, null: true
13
- field :errors, [String], null: false
14
-
15
- def resolve(oauth_client_id:, uris:)
16
- oauth_client = Osso::Models::OauthClient.find(oauth_client_id)
17
-
18
- uris.each do |uri|
19
- oauth_client.redirect_uris.create(uri: uri)
20
- end
21
-
22
- unless oauth_client.primary_redirect_uri
23
- oauth_client.reload.redirect_uris.first.update(primary: true)
24
- end
25
-
26
- response_data(oauth_client: oauth_client.reload)
27
- rescue StandardError => e
28
- response_error(errors: e.message)
29
- end
30
-
31
- def ready?(*)
32
- return true if context[:scope] == :admin
33
-
34
- raise ::GraphQL::ExecutionError, 'Only admin users may mutate OauthClients'
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Osso
4
- module GraphQL
5
- module Mutations
6
- class DeleteRedirectUri < BaseMutation
7
- null false
8
-
9
- argument :id, ID, required: true
10
-
11
- field :oauth_client, Types::OauthClient, null: true
12
- field :errors, [String], null: false
13
-
14
- def resolve(id:)
15
- redirect_uri = Osso::Models::RedirectUri.find(id)
16
-
17
- oauth_client = redirect_uri.oauth_client
18
-
19
- redirect_uri.destroy
20
-
21
- if redirect_uri.primary
22
- oauth_client.redirect_uris.first&.update(primary: true)
23
- end
24
-
25
- return response_data(oauth_client: oauth_client.reload) if redirect_uri.destroy
26
-
27
- response_error(errors: redirect_uri.errors.full_messages)
28
- end
29
-
30
- def ready?(*)
31
- return true if context[:scope] == :admin
32
-
33
- raise ::GraphQL::ExecutionError, 'Only admin users may mutate OauthClients'
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Osso
4
- module GraphQL
5
- module Mutations
6
- class MarkRedirectUriPrimary < BaseMutation
7
- null false
8
-
9
- argument :id, ID, required: true
10
-
11
- field :oauth_client, Types::OauthClient, null: true
12
- field :errors, [String], null: false
13
-
14
- def resolve(id:)
15
- redirect_uri = Osso::Models::RedirectUri.find(id)
16
- oauth_client = redirect_uri.oauth_client
17
-
18
- oauth_client.redirect_uris.update(primary: false)
19
- redirect_uri.update(primary: true)
20
-
21
- response_data(oauth_client: oauth_client.reload)
22
- rescue StandardError => e
23
- response_error(errors: e.message)
24
- end
25
-
26
- def ready?(*)
27
- return true if context[:scope] == :admin
28
-
29
- raise ::GraphQL::ExecutionError, 'Only admin users may mutate OauthClients'
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,17 +0,0 @@
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