usps-jwt_auth 1.2.1 → 1.2.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/usps/jwt_auth/concern.rb +13 -2
- data/lib/usps/jwt_auth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55690055320ed2dfe5ace756f990bedd8769a5003750baa7ab13828330a78052
|
|
4
|
+
data.tar.gz: 9bbadbdcb087a8645b2b057a01020589aacbf0d6a5d498fcc907f30f3e667150
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 57e395c8ee636d9ac8b7d1709927fab0506f4b20acf146925e22829da835bcf943c6151e5732c9b9c6271f348355e8daf7f0c346b31c8bfb9114c93591f03620
|
|
7
|
+
data.tar.gz: f7bdfdb5a52b589639f81481e9bb2bf6906f94b037b0865bb22e91a94db10bd91c0c049922f9243f87c2faa49599e08b97a3686a2e2a74921ef2c98166a2fb23
|
data/Gemfile.lock
CHANGED
|
@@ -64,7 +64,12 @@ module Usps
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def jwt_user
|
|
67
|
-
|
|
67
|
+
return unless fetch_jwt
|
|
68
|
+
# A blank certificate claim is malformed and must never resolve to a member
|
|
69
|
+
# (e.g. a stray blank-certificate row would otherwise authenticate as that record).
|
|
70
|
+
return if jwt['certificate'].blank?
|
|
71
|
+
|
|
72
|
+
@jwt_user ||= JwtAuth.config.find_member.call(jwt['certificate'])
|
|
68
73
|
end
|
|
69
74
|
|
|
70
75
|
def set_new_jwt
|
|
@@ -79,9 +84,15 @@ module Usps
|
|
|
79
84
|
@set_new_jwt = true
|
|
80
85
|
end
|
|
81
86
|
|
|
87
|
+
# Back to where the login began, with the query it began with. The query rides through the login
|
|
88
|
+
# as a single `query_string` parameter, and is unpacked here rather than handed on still packed.
|
|
89
|
+
# It is re-encoded rather than passed through as received, so the redirect stays well-formed
|
|
90
|
+
# whatever arrives.
|
|
82
91
|
def redirect_to_path!
|
|
83
92
|
path = params[:path] || root_path
|
|
84
|
-
|
|
93
|
+
pairs = URI.decode_www_form(params[:query_string].to_s).reject { |key, _value| key.empty? }
|
|
94
|
+
|
|
95
|
+
redirect_to(pairs.empty? ? path : "#{path}?#{URI.encode_www_form(pairs)}")
|
|
85
96
|
end
|
|
86
97
|
|
|
87
98
|
def store_jwt(token)
|