openstax_accounts 7.13.0 → 8.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/openstax/accounts/application_controller.rb +1 -1
  3. data/app/controllers/openstax/accounts/dev/accounts_controller.rb +1 -1
  4. data/app/controllers/openstax/accounts/dev/base_controller.rb +1 -1
  5. data/app/controllers/openstax/accounts/sessions_controller.rb +7 -8
  6. data/app/handlers/openstax/accounts/sessions_callback.rb +17 -37
  7. data/app/models/openstax/accounts/account.rb +33 -1
  8. data/app/models/openstax/accounts/group.rb +12 -8
  9. data/app/models/openstax/accounts/group_nesting.rb +8 -7
  10. data/app/representers/openstax/accounts/api/v1/unclaimed_account_representer.rb +1 -7
  11. data/app/routines/openstax/accounts/find_or_create_account.rb +9 -9
  12. data/app/routines/openstax/accounts/find_or_create_from_sso.rb +23 -0
  13. data/app/routines/openstax/accounts/sync_accounts.rb +1 -6
  14. data/config/routes.rb +11 -11
  15. data/db/migrate/0_create_openstax_accounts_accounts.rb +1 -1
  16. data/db/migrate/10_assign_missing_uuids_for_local_accounts.rb +2 -2
  17. data/db/migrate/11_add_support_identifier_to_accounts_accounts.rb +1 -1
  18. data/db/migrate/12_add_is_test_to_accounts_accounts.rb +1 -1
  19. data/db/migrate/13_add_school_type_to_accounts_accounts.rb +1 -1
  20. data/db/migrate/1_create_openstax_accounts_groups.rb +1 -1
  21. data/db/migrate/2_create_openstax_accounts_group_members.rb +1 -1
  22. data/db/migrate/3_create_openstax_accounts_group_owners.rb +1 -1
  23. data/db/migrate/4_create_openstax_accounts_group_nestings.rb +1 -1
  24. data/db/migrate/5_add_faculty_status_to_accounts_accounts.rb +1 -1
  25. data/db/migrate/6_add_salesforce_contact_id_to_accounts_accounts.rb +1 -1
  26. data/db/migrate/7_change_accounts_openstax_uid_to_be_nullable.rb +1 -1
  27. data/db/migrate/8_change_accounts_username_to_be_nullable.rb +1 -1
  28. data/db/migrate/9_add_uuid_and_role_to_accounts_accounts.rb +1 -1
  29. data/lib/omniauth/strategies/openstax.rb +6 -23
  30. data/lib/openstax/accounts/configuration.rb +16 -0
  31. data/lib/openstax/accounts/current_user_manager.rb +20 -0
  32. data/lib/openstax/accounts/has_many_through_groups/active_record/base.rb +5 -5
  33. data/lib/openstax/accounts/sso.rb +61 -0
  34. data/lib/openstax/accounts/version.rb +1 -1
  35. data/lib/openstax_accounts.rb +6 -7
  36. data/lib/tasks/sync.rake +3 -3
  37. data/spec/factories/openstax_accounts_account.rb +1 -1
  38. data/spec/factories/openstax_accounts_group.rb +3 -3
  39. data/spec/factories/openstax_accounts_group_member.rb +1 -1
  40. data/spec/factories/openstax_accounts_group_nesting.rb +1 -1
  41. data/spec/factories/openstax_accounts_group_owner.rb +1 -1
  42. metadata +34 -212
  43. data/Rakefile +0 -22
  44. data/spec/cassettes/OpenStax_Accounts_FindOrCreateAccount/can_create_users.yml +0 -303
  45. data/spec/controllers/openstax/accounts/dev/accounts_controller_spec.rb +0 -27
  46. data/spec/controllers/openstax/accounts/forwards_params_spec.rb +0 -75
  47. data/spec/controllers/openstax/accounts/sessions_controller_spec.rb +0 -71
  48. data/spec/controllers/openstax/accounts/uses_this_engine_controller_spec.rb +0 -22
  49. data/spec/dummy/README.md +0 -1
  50. data/spec/dummy/Rakefile +0 -7
  51. data/spec/dummy/app/access_policies/account_access_policy.rb +0 -11
  52. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  53. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  54. data/spec/dummy/app/controllers/api/application_groups_controller.rb +0 -11
  55. data/spec/dummy/app/controllers/api/application_users_controller.rb +0 -15
  56. data/spec/dummy/app/controllers/api/dummy_controller.rb +0 -12
  57. data/spec/dummy/app/controllers/api/group_members_controller.rb +0 -11
  58. data/spec/dummy/app/controllers/api/group_nestings_controller.rb +0 -11
  59. data/spec/dummy/app/controllers/api/group_owners_controller.rb +0 -11
  60. data/spec/dummy/app/controllers/api/groups_controller.rb +0 -15
  61. data/spec/dummy/app/controllers/api/users_controller.rb +0 -15
  62. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  63. data/spec/dummy/app/controllers/oauth_controller.rb +0 -10
  64. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  65. data/spec/dummy/app/models/anonymous_user.rb +0 -48
  66. data/spec/dummy/app/models/ownership.rb +0 -7
  67. data/spec/dummy/app/models/user.rb +0 -29
  68. data/spec/dummy/config.ru +0 -5
  69. data/spec/dummy/config/application.rb +0 -23
  70. data/spec/dummy/config/boot.rb +0 -5
  71. data/spec/dummy/config/database.yml +0 -15
  72. data/spec/dummy/config/environment.rb +0 -5
  73. data/spec/dummy/config/environments/development.rb +0 -40
  74. data/spec/dummy/config/environments/production.rb +0 -82
  75. data/spec/dummy/config/environments/test.rb +0 -39
  76. data/spec/dummy/config/initializers/access_policies.rb +0 -1
  77. data/spec/dummy/config/initializers/assets.rb +0 -8
  78. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  79. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  80. data/spec/dummy/config/initializers/doorkeeper.rb +0 -75
  81. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  82. data/spec/dummy/config/initializers/inflections.rb +0 -16
  83. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  84. data/spec/dummy/config/initializers/openstax_accounts.rb +0 -14
  85. data/spec/dummy/config/initializers/session_store.rb +0 -3
  86. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  87. data/spec/dummy/config/locales/en.yml +0 -5
  88. data/spec/dummy/config/routes.rb +0 -45
  89. data/spec/dummy/config/secrets.yml +0 -8
  90. data/spec/dummy/db/development.sqlite3 +0 -0
  91. data/spec/dummy/db/migrate/1000_create_users.rb +0 -11
  92. data/spec/dummy/db/migrate/1001_create_ownerships.rb +0 -11
  93. data/spec/dummy/db/schema.rb +0 -113
  94. data/spec/dummy/db/test.sqlite3 +0 -0
  95. data/spec/dummy/log/development.log +0 -5137
  96. data/spec/dummy/log/test.log +0 -162651
  97. data/spec/dummy/public/404.html +0 -26
  98. data/spec/dummy/public/422.html +0 -26
  99. data/spec/dummy/public/500.html +0 -25
  100. data/spec/dummy/public/favicon.ico +0 -0
  101. data/spec/dummy/script/rails +0 -6
  102. data/spec/handlers/openstax/accounts/accounts_search_spec.rb +0 -63
  103. data/spec/handlers/openstax/accounts/dev/accounts_search_spec.rb +0 -55
  104. data/spec/handlers/openstax/accounts/sessions_callback_spec.rb +0 -119
  105. data/spec/lib/openstax/accounts/api_spec.rb +0 -212
  106. data/spec/lib/openstax/accounts/configuration_spec.rb +0 -39
  107. data/spec/lib/openstax/accounts/current_user_manager_spec.rb +0 -157
  108. data/spec/lib/openstax/accounts/has_many_through_groups/active_record/base_spec.rb +0 -57
  109. data/spec/models/openstax/accounts/account_spec.rb +0 -114
  110. data/spec/models/openstax/accounts/anonymous_account_spec.rb +0 -9
  111. data/spec/models/openstax/accounts/group_spec.rb +0 -51
  112. data/spec/routines/openstax/accounts/create_group_spec.rb +0 -32
  113. data/spec/routines/openstax/accounts/find_or_create_account_spec.rb +0 -76
  114. data/spec/routines/openstax/accounts/search_accounts_shared_examples.rb +0 -160
  115. data/spec/routines/openstax/accounts/search_accounts_spec.rb +0 -6
  116. data/spec/routines/openstax/accounts/search_local_accounts_spec.rb +0 -6
  117. data/spec/routines/openstax/accounts/sync_accounts_spec.rb +0 -101
  118. data/spec/routines/openstax/accounts/sync_groups_spec.rb +0 -143
  119. data/spec/spec_helper.rb +0 -109
  120. data/spec/vcr_helper.rb +0 -14
@@ -1,6 +1,6 @@
1
- class AssignMissingUuidsForLocalAccounts < ActiveRecord::Migration
1
+ class AssignMissingUuidsForLocalAccounts < ActiveRecord::Migration[4.2]
2
2
  def change
3
- enable_extension 'pgcrypto'
3
+ enable_extension :pgcrypto
4
4
 
5
5
  OpenStax::Accounts::Account.where(uuid: nil).update_all('"uuid" = gen_random_uuid()')
6
6
 
@@ -1,4 +1,4 @@
1
- class AddSupportIdentifierToAccountsAccounts < ActiveRecord::Migration
1
+ class AddSupportIdentifierToAccountsAccounts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  enable_extension :citext
4
4
 
@@ -1,4 +1,4 @@
1
- class AddIsTestToAccountsAccounts < ActiveRecord::Migration
1
+ class AddIsTestToAccountsAccounts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :openstax_accounts_accounts, :is_test, :boolean
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddSchoolTypeToAccountsAccounts < ActiveRecord::Migration
1
+ class AddSchoolTypeToAccountsAccounts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :openstax_accounts_accounts, :school_type, :integer, null: false, default: 0
4
4
  add_index :openstax_accounts_accounts, :school_type
@@ -1,4 +1,4 @@
1
- class CreateOpenStaxAccountsGroups < ActiveRecord::Migration
1
+ class CreateOpenStaxAccountsGroups < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :openstax_accounts_groups do |t|
4
4
  t.integer :openstax_uid, null: false
@@ -1,4 +1,4 @@
1
- class CreateOpenStaxAccountsGroupMembers < ActiveRecord::Migration
1
+ class CreateOpenStaxAccountsGroupMembers < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :openstax_accounts_group_members do |t|
4
4
  t.references :group, null: false
@@ -1,4 +1,4 @@
1
- class CreateOpenStaxAccountsGroupOwners < ActiveRecord::Migration
1
+ class CreateOpenStaxAccountsGroupOwners < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :openstax_accounts_group_owners do |t|
4
4
  t.references :group, null: false
@@ -1,4 +1,4 @@
1
- class CreateOpenStaxAccountsGroupNestings < ActiveRecord::Migration
1
+ class CreateOpenStaxAccountsGroupNestings < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :openstax_accounts_group_nestings do |t|
4
4
  t.references :member_group, null: false
@@ -1,4 +1,4 @@
1
- class AddFacultyStatusToAccountsAccounts < ActiveRecord::Migration
1
+ class AddFacultyStatusToAccountsAccounts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :openstax_accounts_accounts, :faculty_status, :integer, default: 0, null: false
4
4
  add_index :openstax_accounts_accounts, :faculty_status
@@ -1,4 +1,4 @@
1
- class AddSalesforceContactIdToAccountsAccounts < ActiveRecord::Migration
1
+ class AddSalesforceContactIdToAccountsAccounts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :openstax_accounts_accounts, :salesforce_contact_id, :string
4
4
  add_index :openstax_accounts_accounts, :salesforce_contact_id
@@ -1,4 +1,4 @@
1
- class ChangeAccountsOpenStaxUidToBeNullable < ActiveRecord::Migration
1
+ class ChangeAccountsOpenStaxUidToBeNullable < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  change_column_null :openstax_accounts_accounts, :openstax_uid, true
4
4
  end
@@ -1,4 +1,4 @@
1
- class ChangeAccountsUsernameToBeNullable < ActiveRecord::Migration
1
+ class ChangeAccountsUsernameToBeNullable < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  change_column_null :openstax_accounts_accounts, :username, true
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddUuidAndRoleToAccountsAccounts < ActiveRecord::Migration
1
+ class AddUuidAndRoleToAccountsAccounts < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :openstax_accounts_accounts, :uuid, :string
4
4
  add_index :openstax_accounts_accounts, :uuid, unique: true
@@ -7,38 +7,21 @@ module OmniAuth
7
7
  option :name, "openstax"
8
8
 
9
9
  option :client_options, {
10
- :site => "http://accounts.openstax.org",
11
- :authorize_url => "/oauth/authorize"
10
+ site: "http://accounts.openstax.org",
11
+ authorize_url: "/oauth/authorize"
12
12
  }
13
13
 
14
- uid { raw_info["id"] }
14
+ uid { raw_info[:id] }
15
15
 
16
16
  info do
17
- username = raw_info["username"]
18
- title = raw_info["title"]
19
- first_name = raw_info["first_name"]
20
- last_name = raw_info["last_name"]
21
- full_name = raw_info["full_name"] || "#{first_name} #{last_name}"
22
- full_name = username if full_name.blank?
23
-
24
17
  # Changed to conform to the omniauth schema
25
- {
26
- name: full_name,
27
- nickname: username,
28
- first_name: first_name,
29
- last_name: last_name,
30
- title: title
31
- }
18
+ raw_info.slice(:name, :first_name, :last_name, :title).merge(nickname: raw_info[:username])
32
19
  end
33
20
 
34
- extra do
35
- {
36
- 'raw_info' => raw_info
37
- }
38
- end
21
+ extra { { raw_info: raw_info } }
39
22
 
40
23
  def raw_info
41
- @raw_info ||= access_token.get('/api/user.json').parsed
24
+ @raw_info ||= access_token.get('/api/user.json').parsed.symbolize_keys
42
25
  end
43
26
 
44
27
  end
@@ -71,6 +71,20 @@ module OpenStax
71
71
  # overloaded.
72
72
  attr_accessor :max_user_updates_per_request
73
73
 
74
+ # sso_secret_key
75
+ # The secret key used to decode the SSO cookie
76
+ # will be used to decryp the shared user session set by accounts
77
+ # when a user logs in, and cleared when they logout
78
+ attr_accessor :sso_secret_key
79
+
80
+ # sso_secret_salt
81
+ # The salt that should be used to decypt the SSO session. Defaults to 'cookie'
82
+ attr_accessor :sso_secret_salt
83
+
84
+ # sso_cookie_name
85
+ # The name of the cookie that stores the SSO session. Defaults to 'ox'
86
+ attr_accessor :sso_cookie_name
87
+
74
88
  def logout_redirect_url(request)
75
89
  (@logout_redirect_url.is_a?(Proc) ?
76
90
  @logout_redirect_url.call(request) :
@@ -111,6 +125,8 @@ module OpenStax
111
125
  :sp # "signed payload"; "sp" for short to keep nested parameter names short
112
126
  ]
113
127
  @max_user_updates_per_request = 250
128
+ @sso_cookie_name = 'ox'
129
+ @sso_secret_salt = 'cookie'
114
130
  super
115
131
  end
116
132
 
@@ -60,6 +60,14 @@ module OpenStax
60
60
  def load_session
61
61
  return unless @current_account.nil?
62
62
 
63
+ # first try to use SSO authentication
64
+ sso = OpenStax::Accounts::Sso.decrypt @request
65
+ if sso.present?
66
+ load_session_from_sso(sso)
67
+ return
68
+ end
69
+
70
+ # If no SSO was found, fall back to using our own session
63
71
  # Sign the user out to reset the session if the request is SSL
64
72
  # and the signed secure ID doesn't match the unsecure ID
65
73
  # http://railscasts.com/episodes/356-dangers-of-session-hijacking
@@ -89,6 +97,18 @@ module OpenStax
89
97
  @current_user = account_user_mapper.account_to_user(@current_account)
90
98
  end
91
99
 
100
+ def load_session_from_sso(sso)
101
+ user_attrs = sso['user']
102
+ account = FindOrCreateFromSso[user_attrs]
103
+ if account.present?
104
+ self.current_user = account_user_mapper.account_to_user(account)
105
+ set_session account
106
+ @session[:account_id] = account.id
107
+ else
108
+ sign_out!
109
+ end
110
+ end
111
+
92
112
  # Sets the current account, updates the session and loads it
93
113
  def current_account=(account)
94
114
  set_session(account)
@@ -6,7 +6,7 @@ module OpenStax
6
6
  def self.included(base)
7
7
  base.extend(ClassMethods)
8
8
  end
9
-
9
+
10
10
  module ClassMethods
11
11
  def has_many_through_groups(groups_name, name, options = {})
12
12
  options = {class_name: name.to_s.classify}.merge(options)
@@ -18,7 +18,7 @@ module OpenStax
18
18
  define_method(name) do
19
19
  OpenStax::Accounts::Group.includes(association_name)
20
20
  .where(openstax_uid: supertree_group_ids)
21
- .collect{|g| g.send(association_name).to_a}.flatten.uniq
21
+ .map { |g| g.send(association_name).to_a }.flatten.uniq
22
22
  end
23
23
  end
24
24
 
@@ -30,11 +30,11 @@ module OpenStax
30
30
  send(association_name).to_a : []
31
31
  indirect_records = OpenStax::Accounts::Group
32
32
  .includes(association_name).where(
33
- openstax_uid: send(groups_name).collect{|g|
33
+ openstax_uid: send(groups_name).map do |g|
34
34
  g.supertree_group_ids
35
- }.flatten.uniq
35
+ end.flatten.uniq
36
36
  )
37
- .collect{|g| g.send(association_name).to_a}
37
+ .map { |g| g.send(association_name).to_a }
38
38
  (direct_records + indirect_records).flatten.uniq
39
39
  end
40
40
  end
@@ -0,0 +1,61 @@
1
+ require 'cgi'
2
+ require 'json'
3
+ require 'active_support'
4
+ require 'openssl'
5
+ require 'base64'
6
+
7
+
8
+ module OpenStax
9
+ module Accounts
10
+ module Sso
11
+
12
+ class InvalidSecretsConfiguration < StandardError; end
13
+
14
+ extend self
15
+
16
+ def user_uuid(request)
17
+ (decrypt(request) || {}).dig("user", "uuid")
18
+ end
19
+
20
+ # https://github.com/rails/rails/blob/4-2-stable/activesupport/lib/active_support/message_encryptor.rb#L90
21
+ def decrypt(request)
22
+ cookie = request.cookies[OpenStax::Accounts.configuration.sso_cookie_name]
23
+ return {} unless cookie.present?
24
+
25
+ begin
26
+ encryptor.decrypt_and_verify(cookie)
27
+ rescue InvalidSecretsConfiguration,
28
+ ActiveSupport::MessageVerifier::InvalidSignature,
29
+ ActiveSupport::MessageEncryptor::InvalidMessage
30
+ {}
31
+ end
32
+
33
+ end
34
+
35
+ private
36
+
37
+ # Not thread-safe
38
+ def encryptor
39
+ @encryptor ||= begin
40
+ key = OpenStax::Accounts.configuration.sso_secret_key
41
+ raise InvalidSecretsConfiguration, 'Missing sso_secret_key configuration' if key.blank?
42
+
43
+ cipher = 'aes-256-cbc'
44
+ salt = OpenStax::Accounts.configuration.sso_secret_salt
45
+ signed_salt = "signed encrypted #{salt}"
46
+ key_generator = ActiveSupport::KeyGenerator.new(key, iterations: 1000)
47
+ secret = key_generator.generate_key(salt)[
48
+ 0, OpenSSL::Cipher.new(cipher).key_len
49
+ ]
50
+ sign_secret = key_generator.generate_key(signed_salt)
51
+ ActiveSupport::MessageEncryptor.new(secret, sign_secret, cipher: cipher, serializer: JSON)
52
+ end
53
+ end
54
+
55
+ def reset_config
56
+ @encryptor = nil
57
+ end
58
+
59
+ end
60
+ end
61
+ end
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Accounts
3
- VERSION = "7.13.0"
3
+ VERSION = "8.1.1"
4
4
  end
5
5
  end
@@ -3,11 +3,12 @@ require 'omniauth'
3
3
  require 'openstax_utilities'
4
4
  require 'uri'
5
5
  require 'omniauth/strategies/openstax'
6
- require 'openstax/accounts/api'
7
- require 'openstax/accounts/configuration'
8
- require 'openstax/accounts/current_user_manager'
9
- require 'openstax/accounts/default_account_user_mapper'
10
- require 'openstax/accounts/engine'
6
+ require_relative 'openstax/accounts/api'
7
+ require_relative 'openstax/accounts/sso'
8
+ require_relative 'openstax/accounts/configuration'
9
+ require_relative 'openstax/accounts/current_user_manager'
10
+ require_relative 'openstax/accounts/default_account_user_mapper'
11
+ require_relative 'openstax/accounts/engine'
11
12
 
12
13
  module OpenStax
13
14
  module Accounts
@@ -27,7 +28,6 @@ module OpenStax
27
28
  # ...
28
29
  # end
29
30
  #
30
-
31
31
  def configure
32
32
  yield configuration
33
33
  end
@@ -37,6 +37,5 @@ module OpenStax
37
37
  end
38
38
 
39
39
  end
40
-
41
40
  end
42
41
  end
data/lib/tasks/sync.rake CHANGED
@@ -2,17 +2,17 @@ namespace :openstax do
2
2
  namespace :accounts do
3
3
  namespace :sync do
4
4
  desc "Sync Accounts with OpenStax Accounts"
5
- task :accounts => :environment do
5
+ task accounts: :environment do
6
6
  OpenStax::Accounts::SyncAccounts.call
7
7
  end
8
8
 
9
9
  desc "Sync Groups with OpenStax Accounts"
10
- task :groups => :environment do
10
+ task groups: :environment do
11
11
  OpenStax::Accounts::SyncGroups.call
12
12
  end
13
13
 
14
14
  desc "Sync Accounts and Groups with OpenStax Accounts"
15
- task :all => [:accounts, :groups]
15
+ task all: [:accounts, :groups]
16
16
  end
17
17
  end
18
18
  end
@@ -8,6 +8,6 @@ FactoryBot.define do
8
8
  school_type { OpenStax::Accounts::Account.school_types[:unknown_school_type] }
9
9
  uuid { SecureRandom.uuid }
10
10
  support_identifier { "cs_#{SecureRandom.hex(4)}" }
11
- is_test true
11
+ is_test { true }
12
12
  end
13
13
  end
@@ -1,7 +1,7 @@
1
1
  FactoryBot.define do
2
- factory :openstax_accounts_group, :class => OpenStax::Accounts::Group do
2
+ factory :openstax_accounts_group, class: OpenStax::Accounts::Group do
3
3
  openstax_uid { -SecureRandom.hex(4).to_i(16)/2 }
4
- name "MyGroup"
5
- is_public false
4
+ name { "MyGroup" }
5
+ is_public { false }
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :openstax_accounts_group_member, :class => OpenStax::Accounts::GroupMember do
2
+ factory :openstax_accounts_group_member, class: OpenStax::Accounts::GroupMember do
3
3
  association :group, factory: :openstax_accounts_group
4
4
  association :user, factory: :openstax_accounts_account
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :openstax_accounts_group_nesting, :class => OpenStax::Accounts::GroupNesting do
2
+ factory :openstax_accounts_group_nesting, class: OpenStax::Accounts::GroupNesting do
3
3
  association :container_group, factory: :openstax_accounts_group
4
4
  association :member_group, factory: :openstax_accounts_group
5
5
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :openstax_accounts_group_owner, :class => OpenStax::Accounts::GroupOwner do
2
+ factory :openstax_accounts_group_owner, class: OpenStax::Accounts::GroupOwner do
3
3
  association :group, factory: :openstax_accounts_group
4
4
  association :user, factory: :openstax_accounts_account
5
5
  end
metadata CHANGED
@@ -1,189 +1,183 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_accounts
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.13.0
4
+ version: 8.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-26 00:00:00.000000000 Z
11
+ date: 2019-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '4.1'
20
17
  - - "<"
21
18
  - !ruby/object:Gem::Version
22
- version: '5.0'
19
+ version: '6.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '4.1'
30
24
  - - "<"
31
25
  - !ruby/object:Gem::Version
32
- version: '5.0'
26
+ version: '6.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: omniauth
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: '1.1'
33
+ version: '0'
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
38
  - - ">="
45
39
  - !ruby/object:Gem::Version
46
- version: '1.1'
40
+ version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: omniauth-oauth2
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - ">="
52
46
  - !ruby/object:Gem::Version
53
- version: '1.1'
47
+ version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - ">="
59
53
  - !ruby/object:Gem::Version
60
- version: '1.1'
54
+ version: '0'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: oauth2
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - ">="
66
60
  - !ruby/object:Gem::Version
67
- version: 0.5.0
61
+ version: '0'
68
62
  type: :runtime
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
66
  - - ">="
73
67
  - !ruby/object:Gem::Version
74
- version: 0.5.0
68
+ version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: representable
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - ">="
80
74
  - !ruby/object:Gem::Version
81
- version: '2.0'
75
+ version: '0'
82
76
  type: :runtime
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - ">="
87
81
  - !ruby/object:Gem::Version
88
- version: '2.0'
82
+ version: '0'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: roar
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
87
  - - ">="
94
88
  - !ruby/object:Gem::Version
95
- version: '1.0'
89
+ version: '0'
96
90
  type: :runtime
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
94
  - - ">="
101
95
  - !ruby/object:Gem::Version
102
- version: '1.0'
96
+ version: '0'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: lev
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
101
  - - ">="
108
102
  - !ruby/object:Gem::Version
109
- version: 2.2.1
103
+ version: '0'
110
104
  type: :runtime
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
108
  - - ">="
115
109
  - !ruby/object:Gem::Version
116
- version: 2.2.1
110
+ version: '0'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: keyword_search
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
115
  - - ">="
122
116
  - !ruby/object:Gem::Version
123
- version: 1.0.0
117
+ version: '0'
124
118
  type: :runtime
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - ">="
129
123
  - !ruby/object:Gem::Version
130
- version: 1.0.0
124
+ version: '0'
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: openstax_utilities
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
129
  - - ">="
136
130
  - !ruby/object:Gem::Version
137
- version: 4.1.0
131
+ version: '0'
138
132
  type: :runtime
139
133
  prerelease: false
140
134
  version_requirements: !ruby/object:Gem::Requirement
141
135
  requirements:
142
136
  - - ">="
143
137
  - !ruby/object:Gem::Version
144
- version: 4.1.0
138
+ version: '0'
145
139
  - !ruby/object:Gem::Dependency
146
140
  name: openstax_api
147
141
  requirement: !ruby/object:Gem::Requirement
148
142
  requirements:
149
143
  - - ">="
150
144
  - !ruby/object:Gem::Version
151
- version: 3.1.0
145
+ version: '0'
152
146
  type: :runtime
153
147
  prerelease: false
154
148
  version_requirements: !ruby/object:Gem::Requirement
155
149
  requirements:
156
150
  - - ">="
157
151
  - !ruby/object:Gem::Version
158
- version: 3.1.0
152
+ version: '0'
159
153
  - !ruby/object:Gem::Dependency
160
154
  name: action_interceptor
161
155
  requirement: !ruby/object:Gem::Requirement
162
156
  requirements:
163
157
  - - ">="
164
158
  - !ruby/object:Gem::Version
165
- version: '1.0'
159
+ version: '0'
166
160
  type: :runtime
167
161
  prerelease: false
168
162
  version_requirements: !ruby/object:Gem::Requirement
169
163
  requirements:
170
164
  - - ">="
171
165
  - !ruby/object:Gem::Version
172
- version: '1.0'
166
+ version: '0'
173
167
  - !ruby/object:Gem::Dependency
174
168
  name: pg
175
169
  requirement: !ruby/object:Gem::Requirement
176
170
  requirements:
177
- - - "<"
171
+ - - ">="
178
172
  - !ruby/object:Gem::Version
179
- version: 1.0.0
173
+ version: '0'
180
174
  type: :runtime
181
175
  prerelease: false
182
176
  version_requirements: !ruby/object:Gem::Requirement
183
177
  requirements:
184
- - - "<"
178
+ - - ">="
185
179
  - !ruby/object:Gem::Version
186
- version: 1.0.0
180
+ version: '0'
187
181
  - !ruby/object:Gem::Dependency
188
182
  name: rspec-rails
189
183
  requirement: !ruby/object:Gem::Requirement
@@ -241,21 +235,7 @@ dependencies:
241
235
  - !ruby/object:Gem::Version
242
236
  version: '0'
243
237
  - !ruby/object:Gem::Dependency
244
- name: quiet_assets
245
- requirement: !ruby/object:Gem::Requirement
246
- requirements:
247
- - - ">="
248
- - !ruby/object:Gem::Version
249
- version: '0'
250
- type: :development
251
- prerelease: false
252
- version_requirements: !ruby/object:Gem::Requirement
253
- requirements:
254
- - - ">="
255
- - !ruby/object:Gem::Version
256
- version: '0'
257
- - !ruby/object:Gem::Dependency
258
- name: thin
238
+ name: puma
259
239
  requirement: !ruby/object:Gem::Requirement
260
240
  requirements:
261
241
  - - ">="
@@ -288,14 +268,14 @@ dependencies:
288
268
  requirements:
289
269
  - - ">="
290
270
  - !ruby/object:Gem::Version
291
- version: 2.0.1
271
+ version: '0'
292
272
  type: :development
293
273
  prerelease: false
294
274
  version_requirements: !ruby/object:Gem::Requirement
295
275
  requirements:
296
276
  - - ">="
297
277
  - !ruby/object:Gem::Version
298
- version: 2.0.1
278
+ version: '0'
299
279
  - !ruby/object:Gem::Dependency
300
280
  name: vcr
301
281
  requirement: !ruby/object:Gem::Requirement
@@ -320,7 +300,6 @@ extra_rdoc_files: []
320
300
  files:
321
301
  - MIT-LICENSE
322
302
  - README.md
323
- - Rakefile
324
303
  - app/assets/javascripts/openstax/accounts/application.js
325
304
  - app/assets/stylesheets/openstax/accounts/application.css
326
305
  - app/assets/stylesheets/openstax/accounts/dev.css.scss
@@ -355,6 +334,7 @@ files:
355
334
  - app/routines/openstax/accounts/create_group.rb
356
335
  - app/routines/openstax/accounts/dev/create_account.rb
357
336
  - app/routines/openstax/accounts/find_or_create_account.rb
337
+ - app/routines/openstax/accounts/find_or_create_from_sso.rb
358
338
  - app/routines/openstax/accounts/search_accounts.rb
359
339
  - app/routines/openstax/accounts/search_local_accounts.rb
360
340
  - app/routines/openstax/accounts/sync_accounts.rb
@@ -392,91 +372,15 @@ files:
392
372
  - lib/openstax/accounts/default_account_user_mapper.rb
393
373
  - lib/openstax/accounts/engine.rb
394
374
  - lib/openstax/accounts/has_many_through_groups/active_record/base.rb
375
+ - lib/openstax/accounts/sso.rb
395
376
  - lib/openstax/accounts/version.rb
396
377
  - lib/openstax_accounts.rb
397
378
  - lib/tasks/sync.rake
398
- - spec/cassettes/OpenStax_Accounts_FindOrCreateAccount/can_create_users.yml
399
- - spec/controllers/openstax/accounts/dev/accounts_controller_spec.rb
400
- - spec/controllers/openstax/accounts/forwards_params_spec.rb
401
- - spec/controllers/openstax/accounts/sessions_controller_spec.rb
402
- - spec/controllers/openstax/accounts/uses_this_engine_controller_spec.rb
403
- - spec/dummy/README.md
404
- - spec/dummy/Rakefile
405
- - spec/dummy/app/access_policies/account_access_policy.rb
406
- - spec/dummy/app/assets/javascripts/application.js
407
- - spec/dummy/app/assets/stylesheets/application.css
408
- - spec/dummy/app/controllers/api/application_groups_controller.rb
409
- - spec/dummy/app/controllers/api/application_users_controller.rb
410
- - spec/dummy/app/controllers/api/dummy_controller.rb
411
- - spec/dummy/app/controllers/api/group_members_controller.rb
412
- - spec/dummy/app/controllers/api/group_nestings_controller.rb
413
- - spec/dummy/app/controllers/api/group_owners_controller.rb
414
- - spec/dummy/app/controllers/api/groups_controller.rb
415
- - spec/dummy/app/controllers/api/users_controller.rb
416
- - spec/dummy/app/controllers/application_controller.rb
417
- - spec/dummy/app/controllers/oauth_controller.rb
418
- - spec/dummy/app/helpers/application_helper.rb
419
- - spec/dummy/app/models/anonymous_user.rb
420
- - spec/dummy/app/models/ownership.rb
421
- - spec/dummy/app/models/user.rb
422
- - spec/dummy/config.ru
423
- - spec/dummy/config/application.rb
424
- - spec/dummy/config/boot.rb
425
- - spec/dummy/config/database.yml
426
- - spec/dummy/config/environment.rb
427
- - spec/dummy/config/environments/development.rb
428
- - spec/dummy/config/environments/production.rb
429
- - spec/dummy/config/environments/test.rb
430
- - spec/dummy/config/initializers/access_policies.rb
431
- - spec/dummy/config/initializers/assets.rb
432
- - spec/dummy/config/initializers/backtrace_silencers.rb
433
- - spec/dummy/config/initializers/cookies_serializer.rb
434
- - spec/dummy/config/initializers/doorkeeper.rb
435
- - spec/dummy/config/initializers/filter_parameter_logging.rb
436
- - spec/dummy/config/initializers/inflections.rb
437
- - spec/dummy/config/initializers/mime_types.rb
438
- - spec/dummy/config/initializers/openstax_accounts.rb
439
- - spec/dummy/config/initializers/session_store.rb
440
- - spec/dummy/config/initializers/wrap_parameters.rb
441
- - spec/dummy/config/locales/en.yml
442
- - spec/dummy/config/routes.rb
443
- - spec/dummy/config/secrets.yml
444
- - spec/dummy/db/development.sqlite3
445
- - spec/dummy/db/migrate/1000_create_users.rb
446
- - spec/dummy/db/migrate/1001_create_ownerships.rb
447
- - spec/dummy/db/schema.rb
448
- - spec/dummy/db/test.sqlite3
449
- - spec/dummy/log/development.log
450
- - spec/dummy/log/test.log
451
- - spec/dummy/public/404.html
452
- - spec/dummy/public/422.html
453
- - spec/dummy/public/500.html
454
- - spec/dummy/public/favicon.ico
455
- - spec/dummy/script/rails
456
379
  - spec/factories/openstax_accounts_account.rb
457
380
  - spec/factories/openstax_accounts_group.rb
458
381
  - spec/factories/openstax_accounts_group_member.rb
459
382
  - spec/factories/openstax_accounts_group_nesting.rb
460
383
  - spec/factories/openstax_accounts_group_owner.rb
461
- - spec/handlers/openstax/accounts/accounts_search_spec.rb
462
- - spec/handlers/openstax/accounts/dev/accounts_search_spec.rb
463
- - spec/handlers/openstax/accounts/sessions_callback_spec.rb
464
- - spec/lib/openstax/accounts/api_spec.rb
465
- - spec/lib/openstax/accounts/configuration_spec.rb
466
- - spec/lib/openstax/accounts/current_user_manager_spec.rb
467
- - spec/lib/openstax/accounts/has_many_through_groups/active_record/base_spec.rb
468
- - spec/models/openstax/accounts/account_spec.rb
469
- - spec/models/openstax/accounts/anonymous_account_spec.rb
470
- - spec/models/openstax/accounts/group_spec.rb
471
- - spec/routines/openstax/accounts/create_group_spec.rb
472
- - spec/routines/openstax/accounts/find_or_create_account_spec.rb
473
- - spec/routines/openstax/accounts/search_accounts_shared_examples.rb
474
- - spec/routines/openstax/accounts/search_accounts_spec.rb
475
- - spec/routines/openstax/accounts/search_local_accounts_spec.rb
476
- - spec/routines/openstax/accounts/sync_accounts_spec.rb
477
- - spec/routines/openstax/accounts/sync_groups_spec.rb
478
- - spec/spec_helper.rb
479
- - spec/vcr_helper.rb
480
384
  homepage: http://github.com/openstax/accounts-rails
481
385
  licenses: []
482
386
  metadata: {}
@@ -500,86 +404,4 @@ rubygems_version: 2.7.3
500
404
  signing_key:
501
405
  specification_version: 4
502
406
  summary: Rails common code and bindings for the 'accounts' API
503
- test_files:
504
- - spec/spec_helper.rb
505
- - spec/dummy/app/access_policies/account_access_policy.rb
506
- - spec/dummy/app/models/anonymous_user.rb
507
- - spec/dummy/app/models/ownership.rb
508
- - spec/dummy/app/models/user.rb
509
- - spec/dummy/app/controllers/application_controller.rb
510
- - spec/dummy/app/controllers/oauth_controller.rb
511
- - spec/dummy/app/controllers/api/group_nestings_controller.rb
512
- - spec/dummy/app/controllers/api/group_owners_controller.rb
513
- - spec/dummy/app/controllers/api/application_users_controller.rb
514
- - spec/dummy/app/controllers/api/dummy_controller.rb
515
- - spec/dummy/app/controllers/api/groups_controller.rb
516
- - spec/dummy/app/controllers/api/users_controller.rb
517
- - spec/dummy/app/controllers/api/group_members_controller.rb
518
- - spec/dummy/app/controllers/api/application_groups_controller.rb
519
- - spec/dummy/app/assets/javascripts/application.js
520
- - spec/dummy/app/assets/stylesheets/application.css
521
- - spec/dummy/app/helpers/application_helper.rb
522
- - spec/dummy/config/secrets.yml
523
- - spec/dummy/config/routes.rb
524
- - spec/dummy/config/locales/en.yml
525
- - spec/dummy/config/environments/production.rb
526
- - spec/dummy/config/environments/development.rb
527
- - spec/dummy/config/environments/test.rb
528
- - spec/dummy/config/environment.rb
529
- - spec/dummy/config/application.rb
530
- - spec/dummy/config/database.yml
531
- - spec/dummy/config/boot.rb
532
- - spec/dummy/config/initializers/backtrace_silencers.rb
533
- - spec/dummy/config/initializers/mime_types.rb
534
- - spec/dummy/config/initializers/filter_parameter_logging.rb
535
- - spec/dummy/config/initializers/session_store.rb
536
- - spec/dummy/config/initializers/wrap_parameters.rb
537
- - spec/dummy/config/initializers/assets.rb
538
- - spec/dummy/config/initializers/access_policies.rb
539
- - spec/dummy/config/initializers/openstax_accounts.rb
540
- - spec/dummy/config/initializers/cookies_serializer.rb
541
- - spec/dummy/config/initializers/doorkeeper.rb
542
- - spec/dummy/config/initializers/inflections.rb
543
- - spec/dummy/config.ru
544
- - spec/dummy/script/rails
545
- - spec/dummy/README.md
546
- - spec/dummy/Rakefile
547
- - spec/dummy/public/favicon.ico
548
- - spec/dummy/public/422.html
549
- - spec/dummy/public/500.html
550
- - spec/dummy/public/404.html
551
- - spec/dummy/db/schema.rb
552
- - spec/dummy/db/test.sqlite3
553
- - spec/dummy/db/migrate/1000_create_users.rb
554
- - spec/dummy/db/migrate/1001_create_ownerships.rb
555
- - spec/dummy/db/development.sqlite3
556
- - spec/dummy/log/test.log
557
- - spec/dummy/log/development.log
558
- - spec/cassettes/OpenStax_Accounts_FindOrCreateAccount/can_create_users.yml
559
- - spec/models/openstax/accounts/anonymous_account_spec.rb
560
- - spec/models/openstax/accounts/account_spec.rb
561
- - spec/models/openstax/accounts/group_spec.rb
562
- - spec/routines/openstax/accounts/create_group_spec.rb
563
- - spec/routines/openstax/accounts/sync_accounts_spec.rb
564
- - spec/routines/openstax/accounts/find_or_create_account_spec.rb
565
- - spec/routines/openstax/accounts/search_local_accounts_spec.rb
566
- - spec/routines/openstax/accounts/search_accounts_shared_examples.rb
567
- - spec/routines/openstax/accounts/sync_groups_spec.rb
568
- - spec/routines/openstax/accounts/search_accounts_spec.rb
569
- - spec/vcr_helper.rb
570
- - spec/factories/openstax_accounts_group.rb
571
- - spec/factories/openstax_accounts_group_owner.rb
572
- - spec/factories/openstax_accounts_group_member.rb
573
- - spec/factories/openstax_accounts_account.rb
574
- - spec/factories/openstax_accounts_group_nesting.rb
575
- - spec/lib/openstax/accounts/api_spec.rb
576
- - spec/lib/openstax/accounts/configuration_spec.rb
577
- - spec/lib/openstax/accounts/has_many_through_groups/active_record/base_spec.rb
578
- - spec/lib/openstax/accounts/current_user_manager_spec.rb
579
- - spec/controllers/openstax/accounts/uses_this_engine_controller_spec.rb
580
- - spec/controllers/openstax/accounts/forwards_params_spec.rb
581
- - spec/controllers/openstax/accounts/dev/accounts_controller_spec.rb
582
- - spec/controllers/openstax/accounts/sessions_controller_spec.rb
583
- - spec/handlers/openstax/accounts/sessions_callback_spec.rb
584
- - spec/handlers/openstax/accounts/dev/accounts_search_spec.rb
585
- - spec/handlers/openstax/accounts/accounts_search_spec.rb
407
+ test_files: []