token_manager 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f1d30fc81116b96e15351a9208a870ddeab36d7c0c157b8375afd1d8f3100d47
4
+ data.tar.gz: 230a7ae244484bba33131dcf3cfed33713d3375b3f7813f1f90f7e30ac16eeee
5
+ SHA512:
6
+ metadata.gz: c947a400ec247ff1003eb5c62ebea2464f07fc1077a28bf1329bd68c5c4c3f17c60b32a84cf0270226bed6137515fb944d43d5607339bc8def0eda94b732bf23
7
+ data.tar.gz: 3a76374f68ea875a88af3f11d9c590999dc50ff572fcd66fdaebb7d0b57ced8f8e0b42e33db70ab9d9bae03376bb5bbc2f84e7310e9ea40592b9bebe84448efd
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,55 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ TargetRubyVersion: 2.6.0
4
+ NewCops: enable
5
+
6
+ require:
7
+ - rubocop-rake
8
+
9
+ Style/Documentation:
10
+ Enabled: false
11
+
12
+ Style/TrailingCommaInHashLiteral:
13
+ Enabled: false
14
+
15
+ Style/SymbolArray:
16
+ Enabled: false
17
+
18
+ Style/NumericLiterals:
19
+ Enabled: false
20
+
21
+ Style/TrailingCommaInArguments:
22
+ Enabled: false
23
+
24
+ Style/FormatStringToken:
25
+ Enabled: false
26
+
27
+ Metrics/MethodLength:
28
+ Max: 35
29
+
30
+ Metrics/AbcSize:
31
+ Max: 40
32
+
33
+ Style/WordArray:
34
+ Enabled: false
35
+
36
+ Metrics/ClassLength:
37
+ Max: 110
38
+
39
+ Metrics/CyclomaticComplexity:
40
+ Max: 10
41
+
42
+ Style/Lambda:
43
+ EnforcedStyle: literal
44
+
45
+ Lint/AmbiguousOperatorPrecedence:
46
+ Enabled: false
47
+
48
+ Bundler/OrderedGems:
49
+ Enabled: false
50
+
51
+ Style/ClassAndModuleChildren:
52
+ Enabled: false
53
+
54
+ Style/RedundantSelf:
55
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-03-20
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at bogdan@seekingalpha.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in token_manager.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+
10
+ gem 'rspec', '~> 3.0'
11
+
12
+ gem 'rubocop', '~> 1.21'
13
+ gem 'rubocop-rake'
14
+ gem 'rubocop-rspec'
15
+ gem 'database_cleaner-redis'
data/Gemfile.lock ADDED
@@ -0,0 +1,94 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ token_manager (0.1.0)
5
+ activesupport
6
+ curb
7
+ jwt (~> 2.0)
8
+ redis
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ activesupport (7.0.4.3)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ tzinfo (~> 2.0)
18
+ ast (2.4.2)
19
+ concurrent-ruby (1.2.2)
20
+ connection_pool (2.3.0)
21
+ curb (1.0.5)
22
+ database_cleaner-core (2.0.1)
23
+ database_cleaner-redis (2.0.0)
24
+ database_cleaner-core (~> 2.0.0)
25
+ redis
26
+ diff-lcs (1.5.0)
27
+ i18n (1.12.0)
28
+ concurrent-ruby (~> 1.0)
29
+ json (2.6.3)
30
+ jwt (2.7.0)
31
+ minitest (5.18.0)
32
+ parallel (1.22.1)
33
+ parser (3.2.1.1)
34
+ ast (~> 2.4.1)
35
+ rainbow (3.1.1)
36
+ rake (13.0.6)
37
+ redis (5.0.6)
38
+ redis-client (>= 0.9.0)
39
+ redis-client (0.14.0)
40
+ connection_pool
41
+ regexp_parser (2.7.0)
42
+ rexml (3.2.5)
43
+ rspec (3.12.0)
44
+ rspec-core (~> 3.12.0)
45
+ rspec-expectations (~> 3.12.0)
46
+ rspec-mocks (~> 3.12.0)
47
+ rspec-core (3.12.1)
48
+ rspec-support (~> 3.12.0)
49
+ rspec-expectations (3.12.2)
50
+ diff-lcs (>= 1.2.0, < 2.0)
51
+ rspec-support (~> 3.12.0)
52
+ rspec-mocks (3.12.4)
53
+ diff-lcs (>= 1.2.0, < 2.0)
54
+ rspec-support (~> 3.12.0)
55
+ rspec-support (3.12.0)
56
+ rubocop (1.48.1)
57
+ json (~> 2.3)
58
+ parallel (~> 1.10)
59
+ parser (>= 3.2.0.0)
60
+ rainbow (>= 2.2.2, < 4.0)
61
+ regexp_parser (>= 1.8, < 3.0)
62
+ rexml (>= 3.2.5, < 4.0)
63
+ rubocop-ast (>= 1.26.0, < 2.0)
64
+ ruby-progressbar (~> 1.7)
65
+ unicode-display_width (>= 2.4.0, < 3.0)
66
+ rubocop-ast (1.27.0)
67
+ parser (>= 3.2.1.0)
68
+ rubocop-capybara (2.17.1)
69
+ rubocop (~> 1.41)
70
+ rubocop-rake (0.6.0)
71
+ rubocop (~> 1.0)
72
+ rubocop-rspec (2.19.0)
73
+ rubocop (~> 1.33)
74
+ rubocop-capybara (~> 2.17)
75
+ ruby-progressbar (1.13.0)
76
+ tzinfo (2.0.6)
77
+ concurrent-ruby (~> 1.0)
78
+ unicode-display_width (2.4.2)
79
+
80
+ PLATFORMS
81
+ x86_64-darwin-21
82
+ x86_64-linux
83
+
84
+ DEPENDENCIES
85
+ database_cleaner-redis
86
+ rake (~> 13.0)
87
+ rspec (~> 3.0)
88
+ rubocop (~> 1.21)
89
+ rubocop-rake
90
+ rubocop-rspec
91
+ token_manager!
92
+
93
+ BUNDLED WITH
94
+ 2.4.8
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Bogdan Guban
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # TokenManager
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/token_manager`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/token_manager. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/token_manager/blob/master/CODE_OF_CONDUCT.md).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the TokenManager project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/token_manager/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TokenManager::FaradayMiddleware
4
+ AUTH_HEADER = 'Authorization'
5
+
6
+ def initialize(app = nil, &block)
7
+ @app = app
8
+ @block = block
9
+ end
10
+
11
+ def call(env)
12
+ env[:request_headers][AUTH_HEADER] ||= %(Token token="#{@block.call}")
13
+
14
+ @app.call(env)
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TokenManager
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,140 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'token_manager/version'
4
+ require 'jwt'
5
+ require 'securerandom'
6
+ require 'curb'
7
+ require 'active_support/all'
8
+ require_relative 'token_manager/faraday_middleware'
9
+
10
+ class TokenManager
11
+ class RetrievePublicKeyError < StandardError; end
12
+ ALGO = 'RS256'
13
+
14
+ def self.token_from(headers)
15
+ headers['Authorization']&.match(/Token token="(\S+)"/)&.[](1) ||
16
+ headers['Authorization']&.match(/Bearer (\S+)/)&.[](1)
17
+ end
18
+
19
+ def initialize(options)
20
+ options = options.deep_stringify_keys
21
+ @service_name = options['service_name'] || raise(ArgumentError, '`service_name` is required')
22
+ @trusted_issuers = options['trusted_issuers'] || {}
23
+ @token_ttl = options['token_ttl']
24
+ @public_key_ttl = options['public_key_ttl'] || 1.day
25
+ @old_key_ttl = options['public_key_ttl'] || 1.month
26
+ end
27
+
28
+ def encode(payload)
29
+ payload = payload.stringify_keys
30
+ raise(ArgumentError, '`aud` is required') unless payload.key?('aud')
31
+
32
+ raise(ArgumentError, '`exp` claim or `token_ttl` config option is required') if !payload.key?('exp') && !@token_ttl
33
+
34
+ payload.reverse_merge!(exp: @token_ttl.seconds.from_now.to_i) if @token_ttl
35
+
36
+ payload = payload.merge(iss: @service_name)
37
+ ::JWT.encode(payload, private_key, ALGO, { kid: key_id })
38
+ end
39
+
40
+ def decode(jwt, options = {})
41
+ options = options.merge(
42
+ algorithm: ALGO,
43
+ required_claims: ['exp', 'iss', 'aud'],
44
+ verify_iss: true,
45
+ iss: @trusted_issuers.keys,
46
+ verify_aud: true,
47
+ aud: @service_name
48
+ )
49
+ ::JWT.decode(jwt, nil, true, options) do |header, payload|
50
+ OpenSSL::PKey::RSA.new(issuer_public_key(iss: payload['iss'], kid: header['kid']))
51
+ end
52
+ end
53
+
54
+ def public_key(kid = key_id)
55
+ @public_key ||= {}
56
+ @public_key[kid.to_s] ||= with_redis { |redis| redis.get(cache_key(:public_key, kid)) }
57
+ end
58
+
59
+ def generate_private_key(expire_current_token: true)
60
+ rsa_private = OpenSSL::PKey::RSA.generate(2048)
61
+ rsa_public = rsa_private.public_key
62
+ next_key_id = SecureRandom.uuid
63
+ with_redis do |redis|
64
+ redis.multi do |multi|
65
+ # set new token
66
+ multi.set(cache_key(:private_key, next_key_id), rsa_private.to_pem)
67
+ multi.set(cache_key(:public_key, next_key_id), rsa_public.to_pem)
68
+ multi.set(cache_key(:key_id), next_key_id)
69
+ if expire_current_token
70
+ # expire current token
71
+ multi.expire(cache_key(:private_key, key_id), @old_key_ttl)
72
+ multi.expire(cache_key(:public_key, key_id), @old_key_ttl)
73
+ end
74
+ end
75
+ end
76
+ # drop memoization
77
+ @key_id = next_key_id
78
+ @private_key = rsa_private
79
+
80
+ rsa_private
81
+ end
82
+
83
+ def key_id
84
+ @key_id ||= with_redis do |c|
85
+ c.get(cache_key(:key_id)) ||
86
+ generate_private_key(expire_current_token: false) && c.get(cache_key(:key_id))
87
+ end
88
+ end
89
+
90
+ private
91
+
92
+ def issuer_public_key(iss:, kid:)
93
+ @issuer_public_key ||= {}
94
+ @issuer_public_key[iss] ||= {}
95
+ @issuer_public_key[iss][kid] ||= if iss == @service_name
96
+ public_key(kid)
97
+ else
98
+ redis_fetch(cache_key(:issuer_public_key, iss, kid), ex: @public_key_ttl) do
99
+ retrieve_issuer_key(iss, kid)
100
+ end
101
+ end
102
+ end
103
+
104
+ def retrieve_issuer_key(iss, kid)
105
+ url = @trusted_issuers.dig(iss, 'url')
106
+ raise(RetrievePublicKeyError, "Add trusted_issuers: { url: 'https://my_app.com/public_key_url' }") unless url
107
+
108
+ response = Curl.get(@trusted_issuers.dig(iss, 'url'), kid: kid)
109
+ unless response.response_code.in?(200..299)
110
+ raise(RetrievePublicKeyError,
111
+ "Can't retrieve public_key from #{response.url}. Response code: #{response.response_code}")
112
+ end
113
+
114
+ parsed = JSON.parse(response.body)
115
+ parsed['public_key']
116
+ end
117
+
118
+ def redis_fetch(key, options = {})
119
+ res = with_redis { |redis| redis.get(key) }
120
+ return res if res
121
+
122
+ res = yield
123
+ with_redis { |redis| redis.set(key, res, **options) }
124
+ res
125
+ end
126
+
127
+ def private_key
128
+ @private_key ||= OpenSSL::PKey::RSA.new(with_redis do |c|
129
+ c.get(cache_key(:private_key, key_id)) || generate_private_key
130
+ end)
131
+ end
132
+
133
+ def cache_key(*args)
134
+ [:token_manager, @service_name, *args].join(':')
135
+ end
136
+
137
+ def with_redis
138
+ raise NotImplementedError
139
+ end
140
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/token_manager/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'token_manager'
7
+ spec.version = TokenManager::VERSION
8
+ spec.authors = ['Bogdan Guban']
9
+ spec.email = ['biguban@gmail.com']
10
+
11
+ spec.summary = 'JWT token manager to organize inter microservice communication'
12
+ spec.description = <<~EODOC
13
+ When you have a lot of microservices it can be hard to manage secret keys for all of them. TokenManager
14
+ handles RSA keys generation, caching and verification.
15
+ EODOC
16
+ spec.homepage = 'https://github.com/bguban'
17
+ spec.license = 'MIT'
18
+ spec.required_ruby_version = '>= 2.6.0'
19
+
20
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
21
+
22
+ spec.metadata['homepage_uri'] = spec.homepage
23
+ spec.metadata['source_code_uri'] = spec.homepage
24
+ spec.metadata['changelog_uri'] = spec.homepage
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+ spec.files = Dir.chdir(__dir__) do
29
+ `git ls-files -z`.split("\x0").reject do |f|
30
+ (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
31
+ end
32
+ end
33
+ spec.bindir = 'exe'
34
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
35
+ spec.require_paths = ['lib']
36
+
37
+ # Uncomment to register a new dependency of your gem
38
+ spec.add_dependency 'activesupport'
39
+ spec.add_dependency 'curb'
40
+ spec.add_dependency 'jwt', '~> 2.0'
41
+ spec.add_dependency 'redis'
42
+
43
+ # For more information and examples about making a new gem, check out our
44
+ # guide at: https://bundler.io/guides/creating_gem.html
45
+ spec.metadata['rubygems_mfa_required'] = 'true'
46
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: token_manager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bogdan Guban
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: curb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: jwt
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: redis
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: |
70
+ When you have a lot of microservices it can be hard to manage secret keys for all of them. TokenManager
71
+ handles RSA keys generation, caching and verification.
72
+ email:
73
+ - biguban@gmail.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".rspec"
79
+ - ".rubocop.yml"
80
+ - CHANGELOG.md
81
+ - CODE_OF_CONDUCT.md
82
+ - Gemfile
83
+ - Gemfile.lock
84
+ - LICENSE.txt
85
+ - README.md
86
+ - Rakefile
87
+ - lib/token_manager.rb
88
+ - lib/token_manager/faraday_middleware.rb
89
+ - lib/token_manager/version.rb
90
+ - token_manager.gemspec
91
+ homepage: https://github.com/bguban
92
+ licenses:
93
+ - MIT
94
+ metadata:
95
+ allowed_push_host: https://rubygems.org/
96
+ homepage_uri: https://github.com/bguban
97
+ source_code_uri: https://github.com/bguban
98
+ changelog_uri: https://github.com/bguban
99
+ rubygems_mfa_required: 'true'
100
+ post_install_message:
101
+ rdoc_options: []
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 2.6.0
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ requirements: []
115
+ rubygems_version: 3.4.6
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: JWT token manager to organize inter microservice communication
119
+ test_files: []