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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/usps/jwt_auth/concern.rb +4 -19
- data/lib/usps/jwt_auth/version.rb +1 -1
- data/lib/usps/jwt_auth.rb +0 -1
- metadata +1 -2
- data/lib/usps/jwt_auth/incorrect_login.rb +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 848bc0fc3b35ca707a3a7666a718615411f66e6c6700ab6f0caca23cf2bc8862
|
|
4
|
+
data.tar.gz: efbd63572b9f486a1240c38d10ccb1aa054ae2ddd82ca5837c78bb41b479b7ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 601620bea4da5310b31744283d4bb2a4a6d9b6f19f6d981a1d864f740b9e00d70f72e984dfaef234ce53e32ab30a8563540eee5fe73c546ac7d9864e3bba97be
|
|
7
|
+
data.tar.gz: e9d31e6bc397f6b577cba0b30e334c718eca12d9e68f0f050241b3bdcfe35d27db0c2cf6f9c315a57e13534235a01131530a6142a423a884b738966ec2f35ea8
|
data/Gemfile.lock
CHANGED
|
@@ -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.
|
|
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?
|
|
70
|
+
return if params[:jwt].blank?
|
|
72
71
|
|
|
73
72
|
store_jwt(params[:jwt])
|
|
74
|
-
|
|
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
|
|
data/lib/usps/jwt_auth.rb
CHANGED
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.
|
|
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
|