auth_jwt_go 0.1.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1455c62435f166383caa9afc07d8b4b3d24dce3fa5b8c79613f7fbb8954bcd0a
4
- data.tar.gz: a7506fce9b03686a43a4cca615181d324ea94b230a05dc7f44a8ec43475d122e
3
+ metadata.gz: 2817def27d6ae0845784b3b57e063fc1c3b4a21030c56cde5d61789774b49265
4
+ data.tar.gz: 425450dec9d47402c5d0bfedc574e718770919c9c476fd07157476658f9312ce
5
5
  SHA512:
6
- metadata.gz: 530105f2086f88bc74f09783c426ad1e1f66ec339497b1ce9bacc1b675ed64c93043ccd9b85e93dee9b1e1d81948967c780f554c912444a133f3a9ef58c35187
7
- data.tar.gz: 512eb15244514ff38e22da3268091691a774ef1f256b3d81f57fdb25b854b0397506e8ae50fb09099e6325cbedd89585690da888b0c34bca217a855b92eae90a
6
+ metadata.gz: 532b6f46e738b630062cd1ffeafd6c8a3b99c93c8c94ef6b0a1c8a74f71e609d43765655a5a699669560b24adb78935500da8e6421d2fdc08ebbf1f32976cac3
7
+ data.tar.gz: 43f81e2560d4e3680a0d00546f20bbe2ef73eb328f2ab0268160ba061941c23e7b3a0625af1edcc2c9b211cfa902d5a4274aaf7ed6d3ab80d4014f48efe04362
data/README.md CHANGED
@@ -8,7 +8,7 @@ Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
10
  gem 'jwt'
11
- gem 'auth_jwt_go', '~> 0.1.0'
11
+ gem 'auth_jwt_go', '~> 1.0.0'
12
12
  ```
13
13
  And then execute:
14
14
 
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -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')}
@@ -1,3 +1,3 @@
1
1
  module AuthJwtGo
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.1"
3
3
  end
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.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-07-30 00:00:00.000000000 Z
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