auth_jwt_go 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/.gitignore +8 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/auth_jwt_go.iml +18 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rakeTasks +7 -0
- data/Gemfile.lock +46 -0
- data/README.md +9 -4
- data/auth_jwt_go-0.1.0.gem +0 -0
- 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/lib/auth_jwt_go.rb +10 -0
- data/lib/auth_jwt_go/version.rb +1 -1
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a08fa9daed7a1c01f7fe3a35c3cef25d8065221f2860c9799133e973ba95796
|
4
|
+
data.tar.gz: a8e0808cddc8c1b668566e4c6a91bc0b6dc0e07438e65c754ff387b7e6413e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bea4c022faf50cf23d8d1a54f536f8c23588400fe5a1de8bc68481e705a887ece741b64494acb6da67182dc2ba4889d1be7b8050c7728b199609ab72b4a89587
|
7
|
+
data.tar.gz: 7c84b69b6cd0e5957be36cae7650354027fac29aaf92f8f5180f0a07adb52f22b720ec46a3c147c73f10dea25f3193d36bca1e830349ae648dc747e015175e08
|
data/.idea/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="inheritedJdk" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.2, RVM: ruby-2.3.7) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="jwt (v2.2.1, RVM: ruby-2.3.7) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-2.3.7) [gem]" level="application" />
|
17
|
+
</component>
|
18
|
+
</module>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="JavaScriptSettings">
|
4
|
+
<option name="languageLevel" value="ES6" />
|
5
|
+
</component>
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.3.7" project-jdk-type="RUBY_SDK" />
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/auth_jwt_go.iml" filepath="$PROJECT_DIR$/.idea/auth_jwt_go.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
auth_jwt_go (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
byebug (11.1.3)
|
10
|
+
coderay (1.1.3)
|
11
|
+
diff-lcs (1.4.4)
|
12
|
+
jwt (2.2.1)
|
13
|
+
method_source (1.0.0)
|
14
|
+
pry (0.13.1)
|
15
|
+
coderay (~> 1.1)
|
16
|
+
method_source (~> 1.0)
|
17
|
+
pry-byebug (3.9.0)
|
18
|
+
byebug (~> 11.0)
|
19
|
+
pry (~> 0.13.0)
|
20
|
+
rake (12.3.3)
|
21
|
+
rspec (3.9.0)
|
22
|
+
rspec-core (~> 3.9.0)
|
23
|
+
rspec-expectations (~> 3.9.0)
|
24
|
+
rspec-mocks (~> 3.9.0)
|
25
|
+
rspec-core (3.9.2)
|
26
|
+
rspec-support (~> 3.9.3)
|
27
|
+
rspec-expectations (3.9.2)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.9.0)
|
30
|
+
rspec-mocks (3.9.1)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.9.0)
|
33
|
+
rspec-support (3.9.3)
|
34
|
+
|
35
|
+
PLATFORMS
|
36
|
+
ruby
|
37
|
+
|
38
|
+
DEPENDENCIES
|
39
|
+
auth_jwt_go!
|
40
|
+
jwt
|
41
|
+
pry-byebug
|
42
|
+
rake (~> 12.0)
|
43
|
+
rspec (~> 3.0)
|
44
|
+
|
45
|
+
BUNDLED WITH
|
46
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# AuthJwtGo
|
2
2
|
|
3
3
|
This gem allows you to make identifications for your microservices and create the Jwt if you wish so
|
4
4
|
|
@@ -7,9 +7,9 @@ This gem allows you to make identifications for your microservices and create th
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem '
|
10
|
+
gem 'jwt'
|
11
|
+
gem 'auth_jwt_go', '~> 0.1.4'
|
11
12
|
```
|
12
|
-
|
13
13
|
And then execute:
|
14
14
|
|
15
15
|
$ bundle install
|
@@ -52,6 +52,11 @@ Or install it yourself as:
|
|
52
52
|
before_action :authorized_user # Identify the user based on the jwt for login
|
53
53
|
end
|
54
54
|
|
55
|
+
5- rspec add in rspec_rails
|
56
|
+
config.include RequestHelpers, type: :controller
|
57
|
+
|
58
|
+
## include helper current_user
|
59
|
+
|
55
60
|
## Contributing
|
56
61
|
|
57
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
62
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/remolacho/auth_jwt_go.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/auth_jwt_go.rb
CHANGED
@@ -27,6 +27,16 @@ module AuthJwtGo
|
|
27
27
|
end
|
28
28
|
end
|
29
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
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
30
40
|
def encode_token(payload)
|
31
41
|
return { message: 'The payload is not present'} unless payload.present?
|
32
42
|
{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:
|
4
|
+
version: 1.0.0
|
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-
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: this authenticates your api with jwt include current_user helper
|
14
14
|
email:
|
@@ -18,11 +18,24 @@ extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
20
|
- ".gitignore"
|
21
|
+
- ".idea/.gitignore"
|
22
|
+
- ".idea/.rakeTasks"
|
23
|
+
- ".idea/auth_jwt_go.iml"
|
24
|
+
- ".idea/misc.xml"
|
25
|
+
- ".idea/modules.xml"
|
26
|
+
- ".idea/vcs.xml"
|
27
|
+
- ".rakeTasks"
|
21
28
|
- ".rspec"
|
22
29
|
- ".travis.yml"
|
23
30
|
- Gemfile
|
31
|
+
- Gemfile.lock
|
24
32
|
- README.md
|
25
33
|
- Rakefile
|
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
|
26
39
|
- auth_jwt_go.gemspec
|
27
40
|
- bin/console
|
28
41
|
- bin/setup
|