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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c900a7d07163d9ac0be04b7c4ae2ef44a60e02fc081ccd6c776bd056445e2e8
4
- data.tar.gz: db7b6e04885c6b2ab24e4a6a05af456466e5f33efa39b85e77741523fa95d186
3
+ metadata.gz: 55690055320ed2dfe5ace756f990bedd8769a5003750baa7ab13828330a78052
4
+ data.tar.gz: 9bbadbdcb087a8645b2b057a01020589aacbf0d6a5d498fcc907f30f3e667150
5
5
  SHA512:
6
- metadata.gz: cf1fb79f6441f3571aacd5e2bd2c888a3125fc52c3c5c9a59f7a78bc7c4d0eacd314973976b12d4abdc3703e4cc2ba4d8083fab2fa2fa3fa48c42ae2fc87e02c
7
- data.tar.gz: 96c07d7c4689b3818f8cf4d497bed1b17b77fc46aa584583a663beb5d00609e4c65306fb8c5503a95bb85ba87b1ea1f01e9a6f7d1676cb48e54d6248f1b20bcd
6
+ metadata.gz: 57e395c8ee636d9ac8b7d1709927fab0506f4b20acf146925e22829da835bcf943c6151e5732c9b9c6271f348355e8daf7f0c346b31c8bfb9114c93591f03620
7
+ data.tar.gz: f7bdfdb5a52b589639f81481e9bb2bf6906f94b037b0865bb22e91a94db10bd91c0c049922f9243f87c2faa49599e08b97a3686a2e2a74921ef2c98166a2fb23
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps-jwt_auth (1.2.1)
4
+ usps-jwt_auth (1.2.3)
5
5
  activesupport (~> 8.0)
6
6
  colorize (~> 1.1)
7
7
  fileutils (~> 1.7)
@@ -64,7 +64,12 @@ module Usps
64
64
  end
65
65
 
66
66
  def jwt_user
67
- @jwt_user ||= JwtAuth.config.find_member.call(jwt['certificate']) if fetch_jwt
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
- redirect_to(params.key?(:query_string) ? "#{path}?query_string=#{CGI.escape(params[:query_string])}" : path)
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module JwtAuth
5
- VERSION = '1.2.1'
5
+ VERSION = '1.2.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander