thecore_backend_commons 3.2.3 → 3.2.5
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4cf64bb68e9bcccd605b40aa32460cbb7ced88874a6ffad06d17e8cc8146c71
|
4
|
+
data.tar.gz: 345dca267915d4fadbc63693309cfc8e143664cab7c6c4fa362bbf97aa9466d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac72482edd4c3e30c42429616411bf6851136ef970bda078a2026eacdbf1e07a31146d8235da56298988db2b83da69074f03efc3fee506afe4b5ebf55e95e6e6
|
7
|
+
data.tar.gz: '0181dd13da02d410a4508c93ecf0a93a8f183fd39676aff557dadc889dc19fc3b5a5296f97e46becc59497335bc4f7eedd0be84d062ddadb1d63a7016313a4c7'
|
@@ -1,3 +1,6 @@
|
|
1
|
+
Rails.application.config.relative_url_root = ENV.fetch("RAILS_RELATIVE_URL_ROOT", "/")
|
2
|
+
Rails.application.config.assets.prefix = "#{ENV.fetch("RAILS_RELATIVE_URL_ROOT", "")}/assets".gsub('//', '/')
|
3
|
+
|
1
4
|
Rails.application.config.active_storage.configure :Disk, root: Rails.root.join("storage")
|
2
5
|
Rails.application.config.action_mailer.delivery_method = :smtp
|
3
|
-
Rails.application.config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/, /file:\/\/*/, 'file://', nil]
|
6
|
+
Rails.application.config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/, /file:\/\/*/, 'file://', nil]
|
@@ -16,12 +16,17 @@ module CableConnectionConcern
|
|
16
16
|
# It looks for a token in the query parameters, or in the headers
|
17
17
|
m = request.query_parameters["token"].presence || request.headers["Authorization"].split(" ").second.strip rescue nil
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
# check for m2m token
|
20
|
+
user = User.where.not(encrypted_access_token: nil).find { |u| BCrypt::Password.new(u.encrypted_access_token) == m } rescue false
|
21
|
+
return user if user
|
22
|
+
|
23
|
+
# check for JWT token
|
24
|
+
body = (::HashWithIndifferentAccess.new(::JWT.decode(m, ::Rails.application.credentials.dig(:secret_key_base).presence||ENV["SECRET_KEY_BASE"], false)[0]) rescue nil)
|
25
|
+
verified_user = env['warden'].user.presence || User.find_by(id: body[:user_id]) rescue false
|
26
|
+
return verified_user if verified_user
|
27
|
+
|
28
|
+
# The Token is not m2m nor JWT, fail
|
29
|
+
return reject_unauthorized_connection
|
25
30
|
end
|
26
31
|
end
|
27
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_backend_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-16 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: thecore_auth_commons
|
@@ -201,7 +200,6 @@ metadata:
|
|
201
200
|
homepage_uri: https://github.com/gabrieletassoni/thecore_backend_commons
|
202
201
|
source_code_uri: https://github.com/gabrieletassoni/thecore_backend_commons
|
203
202
|
changelog_uri: https://github.com/gabrieletassoni/thecore_backend_commons/blob/master/CHANGELOG.md
|
204
|
-
post_install_message:
|
205
203
|
rdoc_options: []
|
206
204
|
require_paths:
|
207
205
|
- lib
|
@@ -216,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
214
|
- !ruby/object:Gem::Version
|
217
215
|
version: '0'
|
218
216
|
requirements: []
|
219
|
-
rubygems_version: 3.
|
220
|
-
signing_key:
|
217
|
+
rubygems_version: 3.6.2
|
221
218
|
specification_version: 4
|
222
219
|
summary: Thecore 3 foundations for the Web UI Backend.
|
223
220
|
test_files: []
|