usps-jwt_auth 0.3.2 → 1.0.0.pre.rc.1

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: fbcf39bf01f8c172152f9d4b9273ac83ac062be6f7a6a25422448b3c2119a06d
4
- data.tar.gz: 72718eecb67ee43236c2feb508ea7aac4da6c0f7c74573759c80d3e22aa12079
3
+ metadata.gz: 848bc0fc3b35ca707a3a7666a718615411f66e6c6700ab6f0caca23cf2bc8862
4
+ data.tar.gz: efbd63572b9f486a1240c38d10ccb1aa054ae2ddd82ca5837c78bb41b479b7ea
5
5
  SHA512:
6
- metadata.gz: b0fd55e7a840f52f0b8c68a2430f8c5cd8f8c7fdec06cb59fdf4c9c0c3ef9be383acfcd0a9cbbb70bb3f3d5140f11627e116b9cc7f1f21438d9cac9091f5b7f4
7
- data.tar.gz: fb1b81135ded60b5fd5836526a4cd53534a75e32525b734ab405864b8f4a28d2ab32f3bdfccbc840c0cab57782c67334f8e4351d9da37f94d7e04f77bc70f808
6
+ metadata.gz: 601620bea4da5310b31744283d4bb2a4a6d9b6f19f6d981a1d864f740b9e00d70f72e984dfaef234ce53e32ab30a8563540eee5fe73c546ac7d9864e3bba97be
7
+ data.tar.gz: e9d31e6bc397f6b577cba0b30e334c718eca12d9e68f0f050241b3bdcfe35d27db0c2cf6f9c315a57e13534235a01131530a6142a423a884b738966ec2f35ea8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps-jwt_auth (0.3.2)
4
+ usps-jwt_auth (1.0.0.pre.rc.1)
5
5
  activesupport (~> 8.0)
6
6
  colorize (~> 1.1)
7
7
  fileutils (~> 1.7)
@@ -5,7 +5,6 @@ module Usps
5
5
  # Controller helpers for handling JWT authentication
6
6
  #
7
7
  module Concern
8
- # Gem rspec skips this block
9
8
  if defined?(ActiveSupport::Concern)
10
9
  extend ActiveSupport::Concern
11
10
 
@@ -42,7 +41,7 @@ module Usps
42
41
  ###############
43
42
 
44
43
  def current_user_from_jwt
45
- reset_session if params.key?(:logout)
44
+ reset_session if params[:logout].present?
46
45
  return if set_new_jwt
47
46
 
48
47
  load_current_user if fetch_jwt.present?
@@ -68,13 +67,11 @@ module Usps
68
67
  end
69
68
 
70
69
  def set_new_jwt
71
- return if params[:jwt].blank? || @set_new_jwt
70
+ return if params[:jwt].blank?
72
71
 
73
72
  store_jwt(params[:jwt])
74
- ensure_valid_jwt_has_valid_member!
75
-
76
- redirect_to(params[:path] || root_path)
77
- @set_new_jwt = true
73
+ redirect_to(params[:path] || root_path) # Breaks the login loop
74
+ nil
78
75
  end
79
76
 
80
77
  def store_jwt(token)
@@ -104,8 +101,6 @@ module Usps
104
101
  end
105
102
 
106
103
  def redirect_to_login
107
- return if @set_new_jwt
108
-
109
104
  url = 'https://www.usps.org/jwt'
110
105
  local = "#{url}?local&port=#{ENV.fetch('PORT', '3000')}"
111
106
  production = "#{url}?application=#{JwtAuth.config.audience}"
@@ -115,16 +110,6 @@ module Usps
115
110
  redirect_to(url, allow_other_host: true)
116
111
  end
117
112
 
118
- def ensure_valid_jwt_has_valid_member!
119
- fetch_jwt
120
- jwt_user
121
- rescue ActiveRecord::RecordNotFound
122
- reset_session
123
- clear_jwt
124
- @current_user = nil
125
- raise IncorrectLogin, 'Valid login without valid member record'
126
- end
127
-
128
113
  def stub_jwt!
129
114
  raise 'Cannot stub JWT outside of test environment!' unless JwtAuth.config.environment.test?
130
115
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module JwtAuth
5
- VERSION = '0.3.2'
5
+ VERSION = '1.0.0-rc.1'
6
6
  end
7
7
  end
data/lib/usps/jwt_auth.rb CHANGED
@@ -35,7 +35,6 @@ require_relative 'jwt_auth/version'
35
35
  require_relative 'jwt_auth/config'
36
36
  require_relative 'jwt_auth/encode'
37
37
  require_relative 'jwt_auth/decode'
38
- require_relative 'jwt_auth/incorrect_login'
39
38
  require_relative 'jwt_auth/concern'
40
39
 
41
40
  # :nocov:
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: 0.3.2
4
+ version: 1.0.0.pre.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -86,7 +86,6 @@ files:
86
86
  - lib/usps/jwt_auth/config.rb
87
87
  - lib/usps/jwt_auth/decode.rb
88
88
  - lib/usps/jwt_auth/encode.rb
89
- - lib/usps/jwt_auth/incorrect_login.rb
90
89
  - lib/usps/jwt_auth/railtie.rb
91
90
  - lib/usps/jwt_auth/version.rb
92
91
  - sig/usps_jwt/auth.rbs
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Usps
4
- module JwtAuth
5
- class IncorrectLogin < StandardError; end
6
- end
7
- end