jwtf 0.0.0 → 0.1.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/.circleci/config.yml +61 -0
- data/.codeclimate.yml +3 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +50 -0
- data/{LICENSE → LICENSE.txt} +5 -5
- data/README.md +161 -2
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/jwtf.gemspec +50 -0
- data/lib/jwtf.rb +22 -2
- data/lib/jwtf/configuration.rb +17 -0
- data/lib/jwtf/encode.rb +43 -0
- data/lib/jwtf/period.rb +38 -0
- data/lib/jwtf/version.rb +3 -0
- metadata +148 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b60481b01b729d24507183085a31b87807a78f1
|
4
|
+
data.tar.gz: f2c6bff39d135f9cd49a63af4ef05b8e26f7a885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 263b8a31ab9279f756733aa6919f83f91103ae02a84e0f5882227bb5d4aeb759c05d2e72eddcf622d39b5f782632142f80ba7f55c4a7c2b22208e5fb4ccd80c3
|
7
|
+
data.tar.gz: 11e423b62142b47d17146ec4372ec53172d82c398d3cb5fe3c1b6c4af96cf0f0ea4e145e74dc6d455e9513608917c419dcf4e8c78f662f4e5b49f940bf5e3452
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
environment:
|
9
|
+
CC_TEST_REPORTER_ID: f1eafbc4f66fbdb2235b2975e1669bd02c7c2e34a9dc7be6db9a1dd80d45d595
|
10
|
+
docker:
|
11
|
+
# specify the version you desire here
|
12
|
+
- image: circleci/ruby:2.4.2-node-browsers
|
13
|
+
|
14
|
+
# Specify service dependencies here if necessary
|
15
|
+
# CircleCI maintains a library of pre-built images
|
16
|
+
# documented at https://circleci.com/docs/2.0/circleci-images/
|
17
|
+
# - image: circleci/postgres:9.4
|
18
|
+
|
19
|
+
working_directory: ~/repo
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- checkout
|
23
|
+
|
24
|
+
# Download and cache dependencies
|
25
|
+
- restore_cache:
|
26
|
+
keys:
|
27
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
28
|
+
# fallback to using the latest cache if no exact match is found
|
29
|
+
- v1-dependencies-
|
30
|
+
|
31
|
+
- run:
|
32
|
+
name: install dependencies
|
33
|
+
command: |
|
34
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
35
|
+
|
36
|
+
- save_cache:
|
37
|
+
paths:
|
38
|
+
- ./vendor/bundle
|
39
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
40
|
+
|
41
|
+
- run:
|
42
|
+
name: Setup Code Climate test-reporter
|
43
|
+
command: |
|
44
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
45
|
+
chmod +x ./cc-test-reporter
|
46
|
+
|
47
|
+
# run tests!
|
48
|
+
- run:
|
49
|
+
name: run tests
|
50
|
+
command: |
|
51
|
+
mkdir /tmp/test-results
|
52
|
+
./cc-test-reporter before-build
|
53
|
+
bundle exec rake test
|
54
|
+
./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?
|
55
|
+
|
56
|
+
# collect reports
|
57
|
+
- store_test_results:
|
58
|
+
path: /tmp/test-results
|
59
|
+
- store_artifacts:
|
60
|
+
path: /tmp/test-results
|
61
|
+
destination: test-results
|
data/.codeclimate.yml
ADDED
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jwtf (0.1.1)
|
5
|
+
jwt (~> 2.1.0, >= 2.1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ansi (1.5.0)
|
11
|
+
builder (3.2.3)
|
12
|
+
coderay (1.1.2)
|
13
|
+
docile (1.1.5)
|
14
|
+
json (2.1.0)
|
15
|
+
jwt (2.1.0)
|
16
|
+
method_source (0.9.0)
|
17
|
+
minitest (5.10.3)
|
18
|
+
minitest-ci (3.4.0)
|
19
|
+
minitest (>= 5.0.6)
|
20
|
+
minitest-reporters (1.1.19)
|
21
|
+
ansi
|
22
|
+
builder
|
23
|
+
minitest (>= 5.0)
|
24
|
+
ruby-progressbar
|
25
|
+
pry (0.11.3)
|
26
|
+
coderay (~> 1.1.0)
|
27
|
+
method_source (~> 0.9.0)
|
28
|
+
rake (10.5.0)
|
29
|
+
ruby-progressbar (1.9.0)
|
30
|
+
simplecov (0.15.1)
|
31
|
+
docile (~> 1.1.0)
|
32
|
+
json (>= 1.8, < 3)
|
33
|
+
simplecov-html (~> 0.10.0)
|
34
|
+
simplecov-html (0.10.2)
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
bundler (~> 1.16)
|
41
|
+
jwtf!
|
42
|
+
minitest (~> 5.0)
|
43
|
+
minitest-ci (~> 3.4.0)
|
44
|
+
minitest-reporters (~> 1.1.19)
|
45
|
+
pry (~> 0.11.3)
|
46
|
+
rake (~> 10.0)
|
47
|
+
simplecov
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
1.16.1
|
data/{LICENSE → LICENSE.txt}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
MIT License
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
3
|
Copyright (c) 2017 Alexandre De Pablo
|
4
4
|
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
copies or substantial portions of the Software.
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
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
|
-
SOFTWARE.
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,2 +1,161 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
[](https://codeclimate.com/github/brindu/jwtf/maintainability)
|
2
|
+
[](https://codeclimate.com/github/brindu/jwtf/test_coverage)
|
3
|
+
|
4
|
+
# JWT Framer
|
5
|
+
|
6
|
+
JWTF allows you to configure how your JSON Web Token are generated. With JWT you
|
7
|
+
are free to choose from a few (a lot !) of options like the signing algorithm
|
8
|
+
you crave for, the associated secret key and all the reserved claims you wish to
|
9
|
+
use ! JWTF offers you a way to configure most of it for your application, so you
|
10
|
+
can concentrate on the access and policy logic you want to put inside your token.
|
11
|
+
|
12
|
+
Wow ! Jeez WTF this looks so cool ! See below for the documentation.
|
13
|
+
|
14
|
+
## Dependencies
|
15
|
+
|
16
|
+
The token generation itself is delegated to the [ruby JWT](https://github.com/jwt/ruby-jwt)
|
17
|
+
gem from its version 2.1.0.
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'jwtf'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install jwtf
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
### Configuration
|
38
|
+
|
39
|
+
Everything take place in a classic ruby configuration block :
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
JWTF.configure do |config|
|
43
|
+
# ...
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
In a Rails application you will typicaly use an initializer for this.
|
48
|
+
|
49
|
+
#### Token encryption algorithm
|
50
|
+
|
51
|
+
All signing algorithms available within the `jwt` gem are supported.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
JWTF.configure do |config|
|
55
|
+
# Specify the algorithm name with an uppercased string as documented in the
|
56
|
+
# jwt gem : https://github.com/jwt/ruby-jwt
|
57
|
+
# Defaults to 'none'
|
58
|
+
config.algorithm = 'HS256'
|
59
|
+
|
60
|
+
# The secret key that will be used to encrypt the generated tokens
|
61
|
+
# Required for algorithms different than 'none'
|
62
|
+
config.secret = 'much secret'
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
TODO Implement usage and tests for HMAC other than 256, RSASSA, ECDSA
|
67
|
+
|
68
|
+
#### Dynamic payload
|
69
|
+
|
70
|
+
To get a JWT you have to call `JWTF.generate`, that's the only public method
|
71
|
+
available. Thanks to this JWTF is a convenient extension for authentication
|
72
|
+
solution like [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper).
|
73
|
+
|
74
|
+
The `JWTF.generate` method (which accepts arguments) dispatch the call to the
|
75
|
+
block given to `config.token_payload`.
|
76
|
+
|
77
|
+
For instance, if you want your JWT payload to be a two fields JSON object : the
|
78
|
+
ID of the user and a boolean which acknowledge if he is an admin or not :
|
79
|
+
|
80
|
+
```json
|
81
|
+
{
|
82
|
+
"uid": 1234,
|
83
|
+
"admin": false
|
84
|
+
}
|
85
|
+
```
|
86
|
+
|
87
|
+
Into the configuration file, implement the dynamic payload creation :
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
JWTF.configure do |config|
|
91
|
+
config.token_payload do |params|
|
92
|
+
user = User.find(params[:user_id]
|
93
|
+
|
94
|
+
# return the hash that will be converted into the token JSON payload
|
95
|
+
{
|
96
|
+
uid: params[:user_id],
|
97
|
+
admin: user.is_admin?
|
98
|
+
}
|
99
|
+
end
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
103
|
+
Then just make such a call to get a new JWT :
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
JWTF.generate(user_id: 1234)
|
107
|
+
```
|
108
|
+
|
109
|
+
#### Reserved claims
|
110
|
+
|
111
|
+
##### Issued At (iat)
|
112
|
+
|
113
|
+
Ensuring the presence of `iat` claim into your JWT payload :
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
JWTF.configure do |config|
|
117
|
+
# When this is true, the "iat" field will be added in the token payload on
|
118
|
+
# its creation. The value will be the JWT creation date (a UNIX timestamp)
|
119
|
+
# Default to false
|
120
|
+
config.use_iat_claim = true
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
124
|
+
##### Expiration time (exp)
|
125
|
+
|
126
|
+
You can give a validity time to your JWT :
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
JWTF.configure do |config|
|
130
|
+
# When exp_period is set, the "exp" field will be added to the tokens'
|
131
|
+
# payload. The JWT will then be valid for the whole period of time specified in
|
132
|
+
# the exp_period hash.
|
133
|
+
config.exp_period = { weeks: 5, hours: 3, ... }
|
134
|
+
end
|
135
|
+
```
|
136
|
+
|
137
|
+
Period symbols listed below can be used (all singular forms are also available) :
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
:seconds
|
141
|
+
:minutes
|
142
|
+
:hours
|
143
|
+
:days
|
144
|
+
:weeks
|
145
|
+
:months
|
146
|
+
:years
|
147
|
+
```
|
148
|
+
|
149
|
+
## Development
|
150
|
+
|
151
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
152
|
+
|
153
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
154
|
+
|
155
|
+
## Contributing
|
156
|
+
|
157
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/brindu/jwtf. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
158
|
+
|
159
|
+
## License
|
160
|
+
|
161
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "jwtf"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
|
+
|
13
|
+
# require "irb"
|
14
|
+
# IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/jwtf.gemspec
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jwtf/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'jwtf'
|
8
|
+
spec.version = JWTF::VERSION
|
9
|
+
spec.authors = ['Alexandre De Pablo']
|
10
|
+
spec.email = ['alexandre.depablo@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'A gem to shape your JSON Web Token with ease.'
|
13
|
+
|
14
|
+
spec.description = <<DESC
|
15
|
+
JWTF allows you to configure how your JSON Web Token are generated. With JWT you
|
16
|
+
are free to choose from a few (a lot !) of options like the signing algorithm
|
17
|
+
you crave for, the associated secret key and all the reserved claims you wish to
|
18
|
+
use ! JWTF offers you a way to configure most of it for your application, so you
|
19
|
+
can concentrate on the access and policy logic you want to put inside your token.
|
20
|
+
DESC
|
21
|
+
|
22
|
+
spec.homepage = 'https://github.com/brindu/jwtf'
|
23
|
+
spec.license = 'MIT'
|
24
|
+
|
25
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
26
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
27
|
+
# if spec.respond_to?(:metadata)
|
28
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
29
|
+
# else
|
30
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
31
|
+
# "public gem pushes."
|
32
|
+
# end
|
33
|
+
|
34
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
35
|
+
f.match(%r{^(test|spec|features)/})
|
36
|
+
end
|
37
|
+
spec.bindir = 'exe'
|
38
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
39
|
+
spec.require_paths = ['lib']
|
40
|
+
|
41
|
+
spec.add_dependency 'jwt', '~> 2.1.0', '>= 2.1.0'
|
42
|
+
|
43
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
44
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
45
|
+
spec.add_development_dependency 'pry', '~> 0.11.3'
|
46
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
47
|
+
spec.add_development_dependency 'minitest-reporters', '~> 1.1.19'
|
48
|
+
spec.add_development_dependency 'minitest-ci', '~> 3.4.0'
|
49
|
+
spec.add_development_dependency 'simplecov'
|
50
|
+
end
|
data/lib/jwtf.rb
CHANGED
@@ -1,5 +1,25 @@
|
|
1
|
+
require 'jwtf/version'
|
2
|
+
require 'jwtf/configuration'
|
3
|
+
require 'jwtf/encode'
|
4
|
+
|
1
5
|
module JWTF
|
2
|
-
def self.
|
3
|
-
|
6
|
+
def self.configure
|
7
|
+
yield(config)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.generate(params = {})
|
11
|
+
encoder.call(params)
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
private
|
16
|
+
|
17
|
+
def config
|
18
|
+
@config ||= Configuration.new
|
19
|
+
end
|
20
|
+
|
21
|
+
def encoder
|
22
|
+
@encoder ||= Encode.new(config)
|
23
|
+
end
|
4
24
|
end
|
5
25
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module JWTF
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :algorithm, :secret, :use_iat_claim, :exp_period
|
4
|
+
attr_reader :payload
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@payload = Proc.new { {} }
|
8
|
+
@algorithm = 'none'
|
9
|
+
@use_iat_claim = false
|
10
|
+
@exp_period = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def token_payload(&block)
|
14
|
+
@payload = block
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/jwtf/encode.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'jwt'
|
2
|
+
require 'jwtf/period'
|
3
|
+
|
4
|
+
module JWTF
|
5
|
+
class Encode
|
6
|
+
attr_reader :config
|
7
|
+
|
8
|
+
def initialize(config)
|
9
|
+
@config = config
|
10
|
+
|
11
|
+
if @config.exp_period
|
12
|
+
@exp_period = JWTF::Period.new(config.exp_period)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(params = {})
|
17
|
+
payload = config.payload.call(params)
|
18
|
+
|
19
|
+
add_iat_claim(payload) if use_iat_claim
|
20
|
+
add_exp_claim(payload) if expiration_date?
|
21
|
+
::JWT.encode(payload, secret, algorithm)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
extend Forwardable
|
27
|
+
|
28
|
+
def_delegators :@config, :algorithm, :secret, :use_iat_claim
|
29
|
+
|
30
|
+
def add_iat_claim(payload)
|
31
|
+
payload[:iat] = Time.now.to_i
|
32
|
+
end
|
33
|
+
|
34
|
+
def expiration_date?
|
35
|
+
@exp_period
|
36
|
+
end
|
37
|
+
|
38
|
+
def add_exp_claim(payload)
|
39
|
+
exp_in_seconds = @exp_period.in_seconds
|
40
|
+
payload['exp'] = Time.now.to_i + exp_in_seconds
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/jwtf/period.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module JWTF
|
2
|
+
class Period
|
3
|
+
def initialize(period)
|
4
|
+
@period = period
|
5
|
+
end
|
6
|
+
|
7
|
+
# @period argument needs to be a hash of this kind :
|
8
|
+
# { months: 2, weeks: 3, ... }
|
9
|
+
def in_seconds
|
10
|
+
@period.reduce(0) do |total_seconds, (period, nb_period)|
|
11
|
+
total_seconds + (nb_period * self.send(period))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def seconds; 1; end
|
18
|
+
alias :second :seconds
|
19
|
+
|
20
|
+
def minutes; 60; end
|
21
|
+
alias :minute :minutes
|
22
|
+
|
23
|
+
def hours; 3600; end
|
24
|
+
alias :hour :hours
|
25
|
+
|
26
|
+
def days; 86_400; end
|
27
|
+
alias :day :days
|
28
|
+
|
29
|
+
def weeks; 604_800; end
|
30
|
+
alias :week :weeks
|
31
|
+
|
32
|
+
def months; 2_592_000; end # 30 days
|
33
|
+
alias :month :months
|
34
|
+
|
35
|
+
def years; 31_557_600; end # 365,25 days
|
36
|
+
alias :year :years
|
37
|
+
end
|
38
|
+
end
|
data/lib/jwtf/version.rb
ADDED
metadata
CHANGED
@@ -1,29 +1,166 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwtf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre De Pablo
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
11
|
+
date: 2018-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jwt
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.1.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.1.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.1.0
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.1.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.16'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.16'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '10.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '10.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: pry
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.11.3
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.11.3
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: minitest
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '5.0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '5.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: minitest-reporters
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.1.19
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.1.19
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: minitest-ci
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 3.4.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 3.4.0
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: simplecov
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
description: |
|
132
|
+
JWTF allows you to configure how your JSON Web Token are generated. With JWT you
|
133
|
+
are free to choose from a few (a lot !) of options like the signing algorithm
|
134
|
+
you crave for, the associated secret key and all the reserved claims you wish to
|
135
|
+
use ! JWTF offers you a way to configure most of it for your application, so you
|
136
|
+
can concentrate on the access and policy logic you want to put inside your token.
|
137
|
+
email:
|
138
|
+
- alexandre.depablo@gmail.com
|
15
139
|
executables: []
|
16
140
|
extensions: []
|
17
141
|
extra_rdoc_files: []
|
18
142
|
files:
|
19
|
-
-
|
143
|
+
- ".circleci/config.yml"
|
144
|
+
- ".codeclimate.yml"
|
145
|
+
- ".gitignore"
|
146
|
+
- ".travis.yml"
|
147
|
+
- Gemfile
|
148
|
+
- Gemfile.lock
|
149
|
+
- LICENSE.txt
|
20
150
|
- README.md
|
151
|
+
- Rakefile
|
152
|
+
- bin/console
|
153
|
+
- bin/setup
|
154
|
+
- jwtf.gemspec
|
21
155
|
- lib/jwtf.rb
|
22
|
-
|
156
|
+
- lib/jwtf/configuration.rb
|
157
|
+
- lib/jwtf/encode.rb
|
158
|
+
- lib/jwtf/period.rb
|
159
|
+
- lib/jwtf/version.rb
|
160
|
+
homepage: https://github.com/brindu/jwtf
|
23
161
|
licenses:
|
24
162
|
- MIT
|
25
|
-
metadata:
|
26
|
-
source_code_uri: https://github.com/brindu/jwtf
|
163
|
+
metadata: {}
|
27
164
|
post_install_message:
|
28
165
|
rdoc_options: []
|
29
166
|
require_paths:
|
@@ -43,5 +180,5 @@ rubyforge_project:
|
|
43
180
|
rubygems_version: 2.6.13
|
44
181
|
signing_key:
|
45
182
|
specification_version: 4
|
46
|
-
summary:
|
183
|
+
summary: A gem to shape your JSON Web Token with ease.
|
47
184
|
test_files: []
|