strongmind-platform-sdk 3.10.3 → 3.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c54bdffdbc7b3419bc8098a873515ae18e3ed9a5a71e9f59779f633d029a37bd
4
- data.tar.gz: 0a414cf9994dc87344960f47e21813c24633200c0f274bc3158a0783143959dc
3
+ metadata.gz: 32983238d5b00f6b1c9307b9002f3d67c49ac105e42e9c1c05a12f4a19b5dfe2
4
+ data.tar.gz: 822510eb37e2958fcc4045547261f0acf23da1dcca5c13301194688e5ee85ed8
5
5
  SHA512:
6
- metadata.gz: ca18372549c1271f58322ede653e46160354d73448dab97789bc57ad8485e12f16d81378c536ae6cfb2c222cc31bdcfedce9035cf84e5b07496abd8593537600
7
- data.tar.gz: 9747e4ca7a24f088e208ded3b9b6e3a36de49a8431946b9cdf76727ce54d4f4b031a6febaeea38c589ee74fe04496cd513aba03704e53da645afb027c6fd9662
6
+ metadata.gz: da20921deabb8c706616233aa3908b6050a36b350b390c80250892c94a4f13bc9e8d2e7598750bb19649c2cf8d3a0ea2643c38dec5b2c6f56485ab1461b85dd9
7
+ data.tar.gz: 6eb34d42a1d20200133fd0c83b63c6a3230e9905abf00aabd77ee0db7432a6b0656e55c59a2a84f07a55aa567338f6382b8ba651a8a184ca8cd8502bcbb285d4
data/Gemfile.lock CHANGED
@@ -1,17 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strongmind-platform-sdk (3.10.3)
4
+ strongmind-platform-sdk (3.11.0)
5
5
  aws-sdk-secretsmanager (~> 1.66)
6
- devise
7
6
  faraday (~> 2.5, >= 2.5.2)
8
7
  faraday-retry
9
8
  jwt
10
9
  learnosity-sdk (~> 0.2.2)
11
10
  multi_json
12
- omniauth
13
- omniauth-rails_csrf_protection
14
- omniauth_openid_connect
15
11
  sentry-ruby
16
12
  strongmind-oneroster-client (~> 2.0.1)
17
13
  uri
@@ -19,21 +15,6 @@ PATH
19
15
  GEM
20
16
  remote: https://rubygems.org/
21
17
  specs:
22
- actionpack (6.1.7.7)
23
- actionview (= 6.1.7.7)
24
- activesupport (= 6.1.7.7)
25
- rack (~> 2.0, >= 2.0.9)
26
- rack-test (>= 0.6.3)
27
- rails-dom-testing (~> 2.0)
28
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
29
- actionview (6.1.7.7)
30
- activesupport (= 6.1.7.7)
31
- builder (~> 3.1)
32
- erubi (~> 1.4)
33
- rails-dom-testing (~> 2.0)
34
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
35
- activemodel (6.1.7.7)
36
- activesupport (= 6.1.7.7)
37
18
  activesupport (6.1.7.7)
38
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
39
20
  i18n (>= 1.6, < 2)
@@ -42,9 +23,7 @@ GEM
42
23
  zeitwerk (~> 2.3)
43
24
  addressable (2.8.6)
44
25
  public_suffix (>= 2.0.2, < 6.0)
45
- aes_key_wrap (1.1.0)
46
26
  ast (2.4.2)
47
- attr_required (1.0.2)
48
27
  aws-eventstream (1.3.0)
49
28
  aws-partitions (1.896.0)
50
29
  aws-sdk-core (3.191.3)
@@ -57,27 +36,12 @@ GEM
57
36
  aws-sigv4 (~> 1.1)
58
37
  aws-sigv4 (1.8.0)
59
38
  aws-eventstream (~> 1, >= 1.0.2)
60
- base64 (0.2.0)
61
- bcrypt (3.1.20)
62
39
  bigdecimal (3.1.6)
63
- bindata (2.5.0)
64
- builder (3.2.4)
65
40
  concurrent-ruby (1.2.3)
66
41
  crack (1.0.0)
67
42
  bigdecimal
68
43
  rexml
69
- crass (1.0.6)
70
- date (3.3.4)
71
- devise (4.9.3)
72
- bcrypt (~> 3.0)
73
- orm_adapter (~> 0.1)
74
- railties (>= 4.1.0)
75
- responders
76
- warden (~> 1.2.3)
77
44
  diff-lcs (1.5.0)
78
- email_validator (2.2.4)
79
- activemodel
80
- erubi (1.12.0)
81
45
  ethon (0.16.0)
82
46
  ffi (>= 1.15.0)
83
47
  factory_bot (6.4.5)
@@ -87,118 +51,27 @@ GEM
87
51
  faraday (2.7.7)
88
52
  faraday-net_http (>= 2.0, < 3.1)
89
53
  ruby2_keywords (>= 0.0.4)
90
- faraday-follow_redirects (0.3.0)
91
- faraday (>= 1, < 3)
92
54
  faraday-net_http (3.0.2)
93
55
  faraday-retry (2.1.0)
94
56
  faraday (~> 2.0)
95
57
  ffi (1.15.5)
96
58
  hashdiff (1.1.0)
97
- hashie (5.0.0)
98
59
  i18n (1.14.1)
99
60
  concurrent-ruby (~> 1.0)
100
61
  jmespath (1.6.2)
101
62
  json (2.6.3)
102
- json-jwt (1.16.6)
103
- activesupport (>= 4.2)
104
- aes_key_wrap
105
- base64
106
- bindata
107
- faraday (~> 2.0)
108
- faraday-follow_redirects
109
63
  jwt (1.5.6)
110
64
  learnosity-sdk (0.2.2)
111
65
  sys-uname (>= 1.0)
112
- loofah (2.22.0)
113
- crass (~> 1.0.2)
114
- nokogiri (>= 1.12.0)
115
- mail (2.8.1)
116
- mini_mime (>= 0.1.1)
117
- net-imap
118
- net-pop
119
- net-smtp
120
- method_source (1.0.0)
121
- mini_mime (1.1.5)
122
- mini_portile2 (2.8.5)
123
66
  minitest (5.22.2)
124
67
  multi_json (1.15.0)
125
- net-imap (0.4.10)
126
- date
127
- net-protocol
128
- net-pop (0.1.2)
129
- net-protocol
130
- net-protocol (0.2.2)
131
- timeout
132
- net-smtp (0.4.0.1)
133
- net-protocol
134
- nokogiri (1.16.2)
135
- mini_portile2 (~> 2.8.2)
136
- racc (~> 1.4)
137
- nokogiri (1.16.2-x86_64-darwin)
138
- racc (~> 1.4)
139
- nokogiri (1.16.2-x86_64-linux)
140
- racc (~> 1.4)
141
- omniauth (2.1.2)
142
- hashie (>= 3.4.6)
143
- rack (>= 2.2.3)
144
- rack-protection
145
- omniauth-rails_csrf_protection (1.0.1)
146
- actionpack (>= 4.2)
147
- omniauth (~> 2.0)
148
- omniauth_openid_connect (0.7.1)
149
- omniauth (>= 1.9, < 3)
150
- openid_connect (~> 2.2)
151
- openid_connect (2.3.0)
152
- activemodel
153
- attr_required (>= 1.0.0)
154
- email_validator
155
- faraday (~> 2.0)
156
- faraday-follow_redirects
157
- json-jwt (>= 1.16)
158
- mail
159
- rack-oauth2 (~> 2.2)
160
- swd (~> 2.0)
161
- tzinfo
162
- validate_url
163
- webfinger (~> 2.0)
164
- orm_adapter (0.5.0)
165
68
  parallel (1.23.0)
166
69
  parser (3.2.2.1)
167
70
  ast (~> 2.4.1)
168
71
  public_suffix (5.0.4)
169
- racc (1.7.3)
170
- rack (2.2.8.1)
171
- rack-oauth2 (2.2.1)
172
- activesupport
173
- attr_required
174
- faraday (~> 2.0)
175
- faraday-follow_redirects
176
- json-jwt (>= 1.11.0)
177
- rack (>= 2.1.0)
178
- rack-protection (3.2.0)
179
- base64 (>= 0.1.0)
180
- rack (~> 2.2, >= 2.2.4)
181
- rack-test (2.1.0)
182
- rack (>= 1.3)
183
- rails-dom-testing (2.2.0)
184
- activesupport (>= 5.0.0)
185
- minitest
186
- nokogiri (>= 1.6)
187
- rails-html-sanitizer (1.6.0)
188
- loofah (~> 2.21)
189
- nokogiri (~> 1.14)
190
- railties (6.1.7.7)
191
- actionpack (= 6.1.7.7)
192
- activesupport (= 6.1.7.7)
193
- method_source
194
- rake (>= 12.2)
195
- thor (~> 1.0)
196
72
  rainbow (3.1.1)
197
73
  rake (13.0.6)
198
74
  regexp_parser (2.8.0)
199
- responders (3.1.1)
200
- actionpack (>= 5.2)
201
- railties (>= 5.2)
202
75
  rexml (3.2.5)
203
76
  rspec (3.12.0)
204
77
  rspec-core (~> 3.12.0)
@@ -232,30 +105,14 @@ GEM
232
105
  strongmind-oneroster-client (2.0.3)
233
106
  json (~> 2.1, >= 2.1.0)
234
107
  typhoeus (~> 1.0, >= 1.0.1)
235
- swd (2.0.3)
236
- activesupport (>= 3)
237
- attr_required (>= 0.0.5)
238
- faraday (~> 2.0)
239
- faraday-follow_redirects
240
108
  sys-uname (1.2.3)
241
109
  ffi (~> 1.1)
242
- thor (1.3.1)
243
- timeout (0.4.1)
244
110
  typhoeus (1.4.0)
245
111
  ethon (>= 0.9.0)
246
112
  tzinfo (2.0.6)
247
113
  concurrent-ruby (~> 1.0)
248
114
  unicode-display_width (2.4.2)
249
115
  uri (0.13.0)
250
- validate_url (1.0.15)
251
- activemodel (>= 3.0.0)
252
- public_suffix
253
- warden (1.2.9)
254
- rack (>= 2.0.9)
255
- webfinger (2.1.3)
256
- activesupport
257
- faraday (~> 2.0)
258
- faraday-follow_redirects
259
116
  webmock (3.22.0)
260
117
  addressable (>= 2.8.0)
261
118
  crack (>= 0.3.2)
@@ -1,45 +1,3 @@
1
- # Add StrongMind Identity to a Rails app
2
- 1. Create a fresh rails app. ex: rails new my-app --css tailwind
3
- 1. Add this to Gemfile:
4
- ```ruby
5
- gem "strongmind-platform-sdk"
6
- gem 'dotenv-rails', groups: [:development, :test] # for environment variables when running locally
7
- gem 'devise'
8
- gem 'omniauth_openid_connect'
9
- gem 'omniauth-rails_csrf_protection'
10
- ```
11
- 1. Run `bundle install`
1
+ # Add StrongMind Identity to a Rails app
12
2
 
13
- 1. Run the generator: `rails g strong_mind_rails_identity:install`
14
-
15
- 1. Remove the first devise line with the default devise plugins from `app/models/user.rb`. You should end up with the only devise line being the following:
16
- ```ruby
17
- devise :omniauthable, omniauth_providers: [:strongmind]
18
- ```
19
-
20
- 1. Create a client in the Identity Server and add the following to the .env file:
21
- ```
22
- IDENTITY_CLIENT_ID=
23
- IDENTITY_CLIENT_SECRET=
24
- IDENTITY_BASE_URL=
25
- APP_BASE_URL=
26
- ```
27
- 1. For local development, run this to enable caching:
28
- ```
29
- rails dev:cache
30
- ```
31
- This will create a file `tmp/caching-dev.txt` that you can delete to disable caching.
32
- 1. If you want user sessions to persist across restarts of your server in dev, and you aren't using redis in dev, add this to `config/environments/development.rb` (instead of `:memory_store`):
33
- ```
34
- config.cache_store = :file_store, "#{Rails.root}/tmp/cache/"
35
- ```
36
-
37
- 1. Do you want all pages to require authentication?
38
- - If yes, add this to `app/controllers/application_controller.rb` right under the class declaration:
39
- ```ruby
40
- before_action :authenticate_user!
41
- ```
42
- - If no, remove line 2 of `app/controllers/strong_mind_auto_login_controller.rb` and add the above line only to controllers that should require authentication.
43
- 1. Execute `bin/rails db:migrate RAILS_ENV=development`
44
-
45
- 1. Start the server: `rails s`
3
+ See [StrongMind Auth gem](https://github.com/StrongMind/rails-auth/blob/main/README.md).
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlatformSdk
4
- VERSION = "3.10.3"
4
+ VERSION = "3.11.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-platform-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.3
4
+ version: 3.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-08 00:00:00.000000000 Z
11
+ date: 2024-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -114,20 +114,6 @@ dependencies:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '1.66'
117
- - !ruby/object:Gem::Dependency
118
- name: devise
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '0'
124
- type: :runtime
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: '0'
131
117
  - !ruby/object:Gem::Dependency
132
118
  name: sentry-ruby
133
119
  requirement: !ruby/object:Gem::Requirement
@@ -142,48 +128,6 @@ dependencies:
142
128
  - - ">="
143
129
  - !ruby/object:Gem::Version
144
130
  version: '0'
145
- - !ruby/object:Gem::Dependency
146
- name: omniauth
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- version: '0'
152
- type: :runtime
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- version: '0'
159
- - !ruby/object:Gem::Dependency
160
- name: omniauth-rails_csrf_protection
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
- type: :runtime
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- version: '0'
173
- - !ruby/object:Gem::Dependency
174
- name: omniauth_openid_connect
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - ">="
178
- - !ruby/object:Gem::Version
179
- version: '0'
180
- type: :runtime
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- version: '0'
187
131
  - !ruby/object:Gem::Dependency
188
132
  name: multi_json
189
133
  requirement: !ruby/object:Gem::Requirement
@@ -218,13 +162,6 @@ files:
218
162
  - README.md
219
163
  - Rakefile
220
164
  - docs/identity_installation_in_rails.md
221
- - lib/generators/strong_mind_rails_identity/install_generator.rb
222
- - lib/generators/templates/add_uid_to_user.rb
223
- - lib/generators/templates/devise.rb
224
- - lib/generators/templates/omniauth_callbacks_controller.rb
225
- - lib/generators/templates/strong_mind_auto_login.html.erb
226
- - lib/generators/templates/strong_mind_auto_login.signed_in.html.erb
227
- - lib/generators/templates/strong_mind_auto_login_controller.rb
228
165
  - lib/platform_sdk.rb
229
166
  - lib/platform_sdk/aws.rb
230
167
  - lib/platform_sdk/aws/secrets_manager_client.rb
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'rails/generators/migration'
3
-
4
- module StrongMindRailsIdentity
5
- class InstallGenerator < Rails::Generators::Base
6
- include Rails::Generators::Migration
7
-
8
- source_root File.expand_path("../templates", __dir__)
9
-
10
- def copy_initializer
11
- template "devise.rb", "config/initializers/devise.rb"
12
- end
13
-
14
- def copy_omniauth_callbacks_controller
15
- copy_file "omniauth_callbacks_controller.rb", "app/controllers/users/omniauth_callbacks_controller.rb"
16
- end
17
-
18
- def copy_auto_login
19
- copy_file "strong_mind_auto_login_controller.rb", "app/controllers/strong_mind_auto_login_controller.rb"
20
- copy_file "strong_mind_auto_login.html.erb", "app/views/strong_mind_auto_login/index.html.erb"
21
- copy_file "strong_mind_auto_login.signed_in.html.erb", "app/views/strong_mind_auto_login/signed_in.html.erb"
22
- end
23
-
24
- def run_devise_user
25
- generate "active_record:devise User"
26
- inject_into_file "app/models/user.rb", after: ":recoverable, :rememberable, :validatable\n" do
27
- " devise :omniauthable, :omniauth_providers => %i[strongmind]
28
-
29
- def self.from_omniauth(auth)
30
- Rails.cache.write(auth.uid, auth)
31
- email = auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress']
32
- user = User.where(uid: auth.uid).first
33
- if user.nil?
34
- user ||= User.create!(uid: auth.uid, email: email)
35
- end
36
- user
37
- end
38
-
39
- def auth
40
- Rails.cache.read(uid)
41
- end"
42
- end
43
-
44
- end
45
-
46
-
47
- def add_devise_routes
48
- devise_route = " devise_for :users, controllers: {
49
- omniauth_callbacks: 'users/omniauth_callbacks'
50
- }
51
- devise_scope :user do
52
- post 'users/sign_out', to: 'devise/sessions#destroy'
53
-
54
- unauthenticated do
55
- root 'strong_mind_auto_login#index', as: :unauthenticated_root
56
- end
57
- authenticated do
58
- root 'strong_mind_auto_login#signed_in'
59
- end
60
- end
61
- ".dup
62
- route devise_route
63
- end
64
-
65
- def uid_migration
66
- migration_template "add_uid_to_user.rb", "db/migrate/add_uid_to_user.rb"
67
- end
68
-
69
- def self.next_migration_number(path)
70
- # Add 1 to make sure this happens after the devise migration
71
- (Time.now.utc.strftime("%Y%m%d%H%M%S").to_i + 1).to_s
72
- end
73
- end
74
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddUidToUser < ActiveRecord::Migration[7.0]
4
- def change
5
- add_column :users, :uid, :string
6
- add_index :users, :uid, unique: true
7
- end
8
- end
@@ -1,328 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Assuming you have not yet modified this file, each configuration option below
4
- # is set to its default value. Note that some are commented out while others
5
- # are not: uncommented lines are intended to protect your configuration from
6
- # breaking changes in upgrades (i.e., in the event that future versions of
7
- # Devise change the default values for those options).
8
- #
9
- # Use this hook to configure devise mailer, warden hooks and so forth.
10
- # Many of these configuration options can be set straight in your model.
11
- Devise.setup do |config|
12
- # The secret key used by Devise. Devise uses this key to generate
13
- # random tokens. Changing this key will render invalid all existing
14
- # confirmation, reset password and unlock tokens in the database.
15
- # Devise will use the `secret_key_base` as its `secret_key`
16
- # by default. You can change it below and use your own secret key.
17
- config.secret_key = ENV['DEVISE_SECRET_KEY'] || '<%= SecureRandom.hex(64) %>'
18
-
19
- # ==> Controller configuration
20
- # Configure the parent class to the devise controllers.
21
- # config.parent_controller = 'DeviseController'
22
-
23
- # ==> Mailer Configuration
24
- # Configure the e-mail address which will be shown in Devise::Mailer,
25
- # note that it will be overwritten if you use your own mailer class
26
- # with default "from" parameter.
27
- config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
28
-
29
- # Configure the class responsible to send e-mails.
30
- # config.mailer = 'Devise::Mailer'
31
-
32
- # Configure the parent class responsible to send e-mails.
33
- # config.parent_mailer = 'ActionMailer::Base'
34
-
35
- # ==> ORM configuration
36
- # Load and configure the ORM. Supports :active_record (default) and
37
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
38
- # available as additional gems.
39
- require 'devise/orm/active_record'
40
-
41
- # ==> Configuration for any authentication mechanism
42
- # Configure which keys are used when authenticating a user. The default is
43
- # just :email. You can configure it to use [:username, :subdomain], so for
44
- # authenticating a user, both parameters are required. Remember that those
45
- # parameters are used only when authenticating and not when retrieving from
46
- # session. If you need permissions, you should implement that in a before filter.
47
- # You can also supply a hash where the value is a boolean determining whether
48
- # or not authentication should be aborted when the value is not present.
49
- # config.authentication_keys = [:email]
50
-
51
- # Configure parameters from the request object used for authentication. Each entry
52
- # given should be a request method and it will automatically be passed to the
53
- # find_for_authentication method and considered in your model lookup. For instance,
54
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
55
- # The same considerations mentioned for authentication_keys also apply to request_keys.
56
- # config.request_keys = []
57
-
58
- # Configure which authentication keys should be case-insensitive.
59
- # These keys will be downcased upon creating or modifying a user and when used
60
- # to authenticate or find a user. Default is :email.
61
- config.case_insensitive_keys = [:email]
62
-
63
- # Configure which authentication keys should have whitespace stripped.
64
- # These keys will have whitespace before and after removed upon creating or
65
- # modifying a user and when used to authenticate or find a user. Default is :email.
66
- config.strip_whitespace_keys = [:email]
67
-
68
- # Tell if authentication through request.params is enabled. True by default.
69
- # It can be set to an array that will enable params authentication only for the
70
- # given strategies, for example, `config.params_authenticatable = [:database]` will
71
- # enable it only for database (email + password) authentication.
72
- # config.params_authenticatable = true
73
-
74
- # Tell if authentication through HTTP Auth is enabled. False by default.
75
- # It can be set to an array that will enable http authentication only for the
76
- # given strategies, for example, `config.http_authenticatable = [:database]` will
77
- # enable it only for database authentication.
78
- # For API-only applications to support authentication "out-of-the-box", you will likely want to
79
- # enable this with :database unless you are using a custom strategy.
80
- # The supported strategies are:
81
- # :database = Support basic authentication with authentication key + password
82
- # config.http_authenticatable = false
83
-
84
- # If 401 status code should be returned for AJAX requests. True by default.
85
- # config.http_authenticatable_on_xhr = true
86
-
87
- # The realm used in Http Basic Authentication. 'Application' by default.
88
- # config.http_authentication_realm = 'Application'
89
-
90
- # It will change confirmation, password recovery and other workflows
91
- # to behave the same regardless if the e-mail provided was right or wrong.
92
- # Does not affect registerable.
93
- # config.paranoid = true
94
-
95
- # By default Devise will store the user in session. You can skip storage for
96
- # particular strategies by setting this option.
97
- # Notice that if you are skipping storage for all authentication paths, you
98
- # may want to disable generating routes to Devise's sessions controller by
99
- # passing skip: :sessions to `devise_for` in your config/routes.rb
100
- config.skip_session_storage = [:http_auth]
101
-
102
- # By default, Devise cleans up the CSRF token on authentication to
103
- # avoid CSRF token fixation attacks. This means that, when using AJAX
104
- # requests for sign in and sign up, you need to get a new CSRF token
105
- # from the server. You can disable this option at your own risk.
106
- # config.clean_up_csrf_token_on_authentication = true
107
-
108
- # When false, Devise will not attempt to reload routes on eager load.
109
- # This can reduce the time taken to boot the app but if your application
110
- # requires the Devise mappings to be loaded during boot time the application
111
- # won't boot properly.
112
- # config.reload_routes = true
113
-
114
- # ==> Configuration for :database_authenticatable
115
- # For bcrypt, this is the cost for hashing the password and defaults to 12. If
116
- # using other algorithms, it sets how many times you want the password to be hashed.
117
- # The number of stretches used for generating the hashed password are stored
118
- # with the hashed password. This allows you to change the stretches without
119
- # invalidating existing passwords.
120
- #
121
- # Limiting the stretches to just one in testing will increase the performance of
122
- # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
123
- # a value less than 10 in other environments. Note that, for bcrypt (the default
124
- # algorithm), the cost increases exponentially with the number of stretches (e.g.
125
- # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
126
- config.stretches = Rails.env.test? ? 1 : 12
127
-
128
- # Set up a pepper to generate the hashed password.
129
- # config.pepper = '<%= SecureRandom.hex(64) %>'
130
-
131
- # Send a notification to the original email when the user's email is changed.
132
- # config.send_email_changed_notification = false
133
-
134
- # Send a notification email when the user's password is changed.
135
- # config.send_password_change_notification = false
136
-
137
- # ==> Configuration for :confirmable
138
- # A period that the user is allowed to access the website even without
139
- # confirming their account. For instance, if set to 2.days, the user will be
140
- # able to access the website for two days without confirming their account,
141
- # access will be blocked just in the third day.
142
- # You can also set it to nil, which will allow the user to access the website
143
- # without confirming their account.
144
- # Default is 0.days, meaning the user cannot access the website without
145
- # confirming their account.
146
- # config.allow_unconfirmed_access_for = 2.days
147
-
148
- # A period that the user is allowed to confirm their account before their
149
- # token becomes invalid. For example, if set to 3.days, the user can confirm
150
- # their account within 3 days after the mail was sent, but on the fourth day
151
- # their account can't be confirmed with the token any more.
152
- # Default is nil, meaning there is no restriction on how long a user can take
153
- # before confirming their account.
154
- # config.confirm_within = 3.days
155
-
156
- # If true, requires any email changes to be confirmed (exactly the same way as
157
- # initial account confirmation) to be applied. Requires additional unconfirmed_email
158
- # db field (see migrations). Until confirmed, new email is stored in
159
- # unconfirmed_email column, and copied to email column on successful confirmation.
160
- config.reconfirmable = true
161
-
162
- # Defines which key will be used when confirming an account
163
- # config.confirmation_keys = [:email]
164
-
165
- # ==> Configuration for :rememberable
166
- # The time the user will be remembered without asking for credentials again.
167
- # config.remember_for = 2.weeks
168
-
169
- # Invalidates all the remember me tokens when the user signs out.
170
- config.expire_all_remember_me_on_sign_out = true
171
-
172
- # If true, extends the user's remember period when remembered via cookie.
173
- # config.extend_remember_period = false
174
-
175
- # Options to be passed to the created cookie. For instance, you can set
176
- # secure: true in order to force SSL only cookies.
177
- # config.rememberable_options = {}
178
-
179
- # ==> Configuration for :validatable
180
- # Range for password length.
181
- config.password_length = 6..128
182
-
183
- # Email regex used to validate email formats. It simply asserts that
184
- # one (and only one) @ exists in the given string. This is mainly
185
- # to give user feedback and not to assert the e-mail validity.
186
- config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
187
-
188
- # ==> Configuration for :timeoutable
189
- # The time you want to timeout the user session without activity. After this
190
- # time the user will be asked for credentials again. Default is 30 minutes.
191
- # config.timeout_in = 30.minutes
192
-
193
- # ==> Configuration for :lockable
194
- # Defines which strategy will be used to lock an account.
195
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
196
- # :none = No lock strategy. You should handle locking by yourself.
197
- # config.lock_strategy = :failed_attempts
198
-
199
- # Defines which key will be used when locking and unlocking an account
200
- # config.unlock_keys = [:email]
201
-
202
- # Defines which strategy will be used to unlock an account.
203
- # :email = Sends an unlock link to the user email
204
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
205
- # :both = Enables both strategies
206
- # :none = No unlock strategy. You should handle unlocking by yourself.
207
- # config.unlock_strategy = :both
208
-
209
- # Number of authentication tries before locking an account if lock_strategy
210
- # is failed attempts.
211
- # config.maximum_attempts = 20
212
-
213
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
214
- # config.unlock_in = 1.hour
215
-
216
- # Warn on the last attempt before the account is locked.
217
- # config.last_attempt_warning = true
218
-
219
- # ==> Configuration for :recoverable
220
- #
221
- # Defines which key will be used when recovering the password for an account
222
- # config.reset_password_keys = [:email]
223
-
224
- # Time interval you can reset your password with a reset password key.
225
- # Don't put a too small interval or your users won't have the time to
226
- # change their passwords.
227
- config.reset_password_within = 6.hours
228
-
229
- # When set to false, does not sign a user in automatically after their password is
230
- # reset. Defaults to true, so a user is signed in automatically after a reset.
231
- # config.sign_in_after_reset_password = true
232
-
233
- # ==> Configuration for :encryptable
234
- # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
235
- # You can use :sha1, :sha512 or algorithms from others authentication tools as
236
- # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
237
- # for default behavior) and :restful_authentication_sha1 (then you should set
238
- # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
239
- #
240
- # Require the `devise-encryptable` gem when using anything other than bcrypt
241
- # config.encryptor = :sha512
242
-
243
- # ==> Scopes configuration
244
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
245
- # "users/sessions/new". It's turned off by default because it's slower if you
246
- # are using only default views.
247
- # config.scoped_views = false
248
-
249
- # Configure the default scope given to Warden. By default it's the first
250
- # devise role declared in your routes (usually :user).
251
- # config.default_scope = :user
252
-
253
- # Set this configuration to false if you want /users/sign_out to sign out
254
- # only the current scope. By default, Devise signs out all scopes.
255
- # config.sign_out_all_scopes = true
256
-
257
- # ==> Navigation configuration
258
- # Lists the formats that should be treated as navigational. Formats like
259
- # :html should redirect to the sign in page when the user does not have
260
- # access, but formats like :xml or :json, should return 401.
261
- #
262
- # If you have any extra navigational formats, like :iphone or :mobile, you
263
- # should add them to the navigational formats lists.
264
- #
265
- # The "*/*" below is required to match Internet Explorer requests.
266
- # config.navigational_formats = ['*/*', :html, :turbo_stream]
267
-
268
- # The default HTTP method used to sign out a resource. Default is :delete.
269
- config.sign_out_via = :delete
270
-
271
- # ==> OmniAuth
272
- # Add a new OmniAuth provider. Check the wiki for more information on setting
273
- # up on your models and hooks.
274
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
275
- identity_base_url = ENV['IDENTITY_BASE_URL'] || "https://devlogin.strongmind.com"
276
- app_base_url = ENV['APP_BASE_URL'] || "http://localhost:3000"
277
- config.omniauth :openid_connect, {
278
- name: :strongmind,
279
- scope: %i[openid profile],
280
- response_type: :code,
281
- issuer: identity_base_url,
282
- discovery: true,
283
- post_logout_redirect_uri: app_base_url,
284
- client_options: {
285
- identifier: ENV['IDENTITY_CLIENT_ID'],
286
- secret: ENV['IDENTITY_CLIENT_SECRET'],
287
- redirect_uri: "#{app_base_url}/users/auth/strongmind/callback"
288
- }
289
- }
290
-
291
- # ==> Warden configuration
292
- # If you want to use other strategies, that are not supported by Devise, or
293
- # change the failure app, you can configure them inside the config.warden block.
294
- #
295
- # config.warden do |manager|
296
- # manager.intercept_401 = false
297
- # manager.default_strategies(scope: :user).unshift :some_external_strategy
298
- # end
299
-
300
- # ==> Mountable engine configurations
301
- # When using Devise inside an engine, let's call it `MyEngine`, and this engine
302
- # is mountable, there are some extra configurations to be taken into account.
303
- # The following options are available, assuming the engine is mounted as:
304
- #
305
- # mount MyEngine, at: '/my_engine'
306
- #
307
- # The router that invoked `devise_for`, in the example above, would be:
308
- # config.router_name = :my_engine
309
- #
310
- # When using OmniAuth, Devise cannot automatically set OmniAuth path,
311
- # so you need to do it manually. For the users scope, it would be:
312
- # config.omniauth_path_prefix = '/my_engine/users/auth'
313
-
314
- # ==> Hotwire/Turbo configuration
315
- # When using Devise with Hotwire/Turbo, the http status for error responses
316
- # and some redirects must match the following. The default in Devise for existing
317
- # apps is `200 OK` and `302 Found respectively`, but new apps are generated with
318
- # these new defaults that match Hotwire/Turbo behavior.
319
- # Note: These might become the new default in future versions of Devise.
320
- config.responder.error_status = :unprocessable_entity
321
- config.responder.redirect_status = :see_other
322
-
323
- # ==> Configuration for :registerable
324
-
325
- # When set to false, does not sign a user in automatically after their password is
326
- # changed. Defaults to true, so a user is signed in automatically after changing a password.
327
- # config.sign_in_after_change_password = true
328
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Users
4
- class OmniauthCallbacksController < Devise::OmniauthCallbacksController
5
-
6
- def strongmind
7
- auth = request.env['omniauth.auth']
8
- @user = User.from_omniauth(auth)
9
- session[:full_name] = "#{auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname']} #{auth.extra.raw_info['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname']}"
10
- sign_in_and_redirect @user
11
- end
12
-
13
- def failure
14
- redirect_to root_url
15
- end
16
- end
17
- end
@@ -1,11 +0,0 @@
1
- <%= button_to 'Sign in with StrongMind', '/users/auth/strongmind', style: 'display:none' %>
2
- <script type="text/javascript">
3
- function submitForm() {
4
- document.forms[0].submit();
5
- }
6
- // Submit the form on load
7
- window.addEventListener("load", (event) => {
8
- submitForm();
9
- });
10
-
11
- </script>
@@ -1,8 +0,0 @@
1
- <div>
2
- <div>
3
- Hi <%= session[:full_name] %>!
4
- </div>
5
- <div>
6
- <%= button_to 'Sign out', '/users/sign_out', style: 'display:inline' %>
7
- </div>
8
- </div>
@@ -1,7 +0,0 @@
1
- class StrongMindAutoLoginController < ApplicationController
2
- skip_before_action :authenticate_user!, only: :index
3
-
4
- def signed_in
5
- render
6
- end
7
- end