auth_jwt_go 0.1.1 → 1.0.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/README.md +1 -1
- data/auth_jwt_go-0.1.1.gem +0 -0
- data/auth_jwt_go-0.1.2.gem +0 -0
- data/auth_jwt_go-0.1.3.gem +0 -0
- data/auth_jwt_go-0.1.4.gem +0 -0
- data/auth_jwt_go-1.0.0.gem +0 -0
- data/lib/auth_jwt_go.rb +12 -6
- data/lib/auth_jwt_go/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2817def27d6ae0845784b3b57e063fc1c3b4a21030c56cde5d61789774b49265
|
4
|
+
data.tar.gz: 425450dec9d47402c5d0bfedc574e718770919c9c476fd07157476658f9312ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 532b6f46e738b630062cd1ffeafd6c8a3b99c93c8c94ef6b0a1c8a74f71e609d43765655a5a699669560b24adb78935500da8e6421d2fdc08ebbf1f32976cac3
|
7
|
+
data.tar.gz: 43f81e2560d4e3680a0d00546f20bbe2ef73eb328f2ab0268160ba061941c23e7b3a0625af1edcc2c9b211cfa902d5a4274aaf7ed6d3ab80d4014f48efe04362
|
data/README.md
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/auth_jwt_go.rb
CHANGED
@@ -21,18 +21,24 @@ module AuthJwtGo
|
|
21
21
|
render json: { message: "The error was #{e.to_s}" }, status: 500
|
22
22
|
end
|
23
23
|
|
24
|
-
def authorized_tenant
|
25
|
-
{ message: 'The user has not token active', status: 403 } unless logged_in?
|
26
|
-
rescue StandardError => e
|
27
|
-
{ message: e.to_s, status: 500 }
|
28
|
-
end
|
29
|
-
|
30
24
|
def authorized_app
|
31
25
|
unless AuthJwtGo::secret_key_api.eql?(auth_client)
|
32
26
|
render json: {message: 'The app has not access' }, status: 401
|
33
27
|
end
|
34
28
|
end
|
35
29
|
|
30
|
+
def decoded_tenant(http_request)
|
31
|
+
return { message: 'The jwt can not decode!!!!', error: true } unless http_request.env["HTTP_AUTHORIZATION"]
|
32
|
+
token = http_request.env["HTTP_AUTHORIZATION"].split(' ')[1]
|
33
|
+
decode = JWT.decode(token, AuthJwtGo::secret_key_jwt, true, { algorithm: AuthJwtGo::algorithm || 'HS256'} )
|
34
|
+
return { message: 'The jwt can not decode!!!!', error: true } unless decode
|
35
|
+
AuthJwtGo::AuthorizedUser.new(decode[0])
|
36
|
+
rescue JWT::DecodeError => e
|
37
|
+
{ message: "JWT::DecodeError => #{e.to_s}", error: true }
|
38
|
+
rescue JWT::ExpiredSignature => e
|
39
|
+
{ message: "JWT::ExpiredSignature => #{e.to_s}", error: true }
|
40
|
+
end
|
41
|
+
|
36
42
|
def encode_token(payload)
|
37
43
|
return { message: 'The payload is not present'} unless payload.present?
|
38
44
|
{jwt: JWT.encode(payload, AuthJwtGo::secret_key_jwt, AuthJwtGo::algorithm || 'HS256')}
|
data/lib/auth_jwt_go/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth_jwt_go
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jonathan rojas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: this authenticates your api with jwt include current_user helper
|
14
14
|
email:
|
@@ -32,6 +32,11 @@ files:
|
|
32
32
|
- README.md
|
33
33
|
- Rakefile
|
34
34
|
- auth_jwt_go-0.1.0.gem
|
35
|
+
- auth_jwt_go-0.1.1.gem
|
36
|
+
- auth_jwt_go-0.1.2.gem
|
37
|
+
- auth_jwt_go-0.1.3.gem
|
38
|
+
- auth_jwt_go-0.1.4.gem
|
39
|
+
- auth_jwt_go-1.0.0.gem
|
35
40
|
- auth_jwt_go.gemspec
|
36
41
|
- bin/console
|
37
42
|
- bin/setup
|