jwtauth 0.3.2 → 0.3.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/lib/jwtauth.rb +20 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 272c2578828235b0729ddb1f8b0b19052f078760
|
4
|
+
data.tar.gz: 1f33e69e68dbcd9bec472dbff45167850400229b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3602033735e11cf0d939010056793c12d03eb734657357e160eb7d89fde62ee83117ffdbd666e53b1bf22074123d710b36b70e092655e6c6359163605bcca86a
|
7
|
+
data.tar.gz: 231657b042b72522c97f1d7e50c52e53b1db5fac36a369fe4ace4e0efc6e262299615a9fdba92a34af13583f52a3e3f5ef48e439d9f7bae604c384c0bca73d31
|
data/lib/jwtauth.rb
CHANGED
@@ -29,6 +29,15 @@ module Jwtauth
|
|
29
29
|
# mattr_accessor :algorithm
|
30
30
|
@@algorithm = 'RS256'
|
31
31
|
|
32
|
+
# Setting name of authentication params
|
33
|
+
@@headers_names = {
|
34
|
+
:'access-token' => 'access-token',
|
35
|
+
:'client' => 'client',
|
36
|
+
:'expiry' => 'expiry',
|
37
|
+
:'uid' => 'uid',
|
38
|
+
:'token-type' => 'token-type'
|
39
|
+
}
|
40
|
+
|
32
41
|
# Option when used jwtauth
|
33
42
|
@@test_mode = false
|
34
43
|
|
@@ -113,6 +122,14 @@ module Jwtauth
|
|
113
122
|
@@current_user = current_user
|
114
123
|
end
|
115
124
|
|
125
|
+
def self.headers_names
|
126
|
+
@@headers_names
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.headers_names=(headers_names)
|
130
|
+
@@headers_names = @@headers_names.merge(headers_names) if headers_names.is_a?(Hash)
|
131
|
+
end
|
132
|
+
|
116
133
|
# Define abstract class error of when call authservice
|
117
134
|
class AuthorizedError < StandardError; end
|
118
135
|
class SocketError < AuthorizedError; end
|
@@ -138,9 +155,9 @@ module Jwtauth
|
|
138
155
|
uri = URI(Jwtauth.session_path)
|
139
156
|
|
140
157
|
uri.query = CGI.unescape({
|
141
|
-
'uid' => origin_request.headers['uid'],
|
142
|
-
'client' => origin_request.headers['client'],
|
143
|
-
'access-token' => origin_request.headers['access-token'],
|
158
|
+
Jwtauth.headers_names[:'uid'] => origin_request.headers[Jwtauth.headers_names[:'uid']] || origin_request.params[Jwtauth.headers_names[:'uid']],
|
159
|
+
Jwtauth.headers_names[:'client'] => origin_request.headers[Jwtauth.headers_names[:'client']] || origin_request.params[Jwtauth.headers_names[:'client']],
|
160
|
+
Jwtauth.headers_names[:'access-token'] => origin_request.headers[Jwtauth.headers_names[:'access-token']] || origin_request.params[Jwtauth.headers_names[:'access-token']],
|
144
161
|
'namespace' => Jwtauth.namespace,
|
145
162
|
}.to_query)
|
146
163
|
|