jwt-ext 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d00324d09d0142344affe3c919a730da895df281
4
+ data.tar.gz: c64e1089e82db5d77402bee80007e5f3b0335d7c
5
+ SHA512:
6
+ metadata.gz: b3f650b9aa09aee73706dddbe94158517816c2374052a9337b8282ddb0fc4808beeef156eb8d134dd8ea238a3f38f722b0b046fe7445db258e6a3c4ddae29b8f
7
+ data.tar.gz: e575bf9ced18a69c2d3370aa511db4611dae137b603d7fa073938a21ed60dd5721373edcb6be2e9c831e10d91f390a7c33030f6ac9ab8ea408cf5a05407c4e7c
@@ -0,0 +1,26 @@
1
+ ---
2
+ engines:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ - ruby
8
+ - javascript
9
+ - python
10
+ - php
11
+ fixme:
12
+ enabled: true
13
+ rubocop:
14
+ enabled: true
15
+ ratings:
16
+ paths:
17
+ - "**.css"
18
+ - "**.inc"
19
+ - "**.js"
20
+ - "**.jsx"
21
+ - "**.module"
22
+ - "**.php"
23
+ - "**.py"
24
+ - "**.rb"
25
+ exclude_paths:
26
+ - spec/
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/examples.txt
10
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,9 @@
1
+ Metrics/BlockLength:
2
+ Exclude:
3
+ - spec/**/*.rb
4
+
5
+ Style/Documentation:
6
+ Enabled: false
7
+
8
+ Style/FrozenStringLiteralComment:
9
+ Enabled: false
@@ -0,0 +1 @@
1
+ SimpleCov.start
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.4.0
4
+ - 2.3.3
5
+ - 2.3.1
6
+ - 2.3.0
7
+ - 2.2.6
8
+ - 2.1.10
9
+ - 2.1.9
10
+ addons:
11
+ code_climate:
12
+ repo_token:
13
+ secure: T5j8mRouYwjc9DdAYm0Xn0rf0bSbgW+q5XgfXZhWsEk91z9jZhaot6CG4qsJxaxrdOxtptOwvF41wYt7mdW1vPaujrymuatB3bFGuR0rrUEz55wf+q8jaOaoWIKNFxV4n5eb64gIeF60ScmlVRPON4CJgGyLd11X3aF6o39mIDoJFC2ca19sw1HLH4iFXZLMnQ2WbGobeq5wTYzlSgHEIhPQiUt3z2+yEMV+qmHv896+qnfBMfrZuGn95/oByX+iF2nM7wsOHDOoeBDiidbY/mZdhkbGCw2SDwZ0SFlwzIOw+rlKUBlRy5GqqhDG0HG3uDho0oWnpM8gNK48lbY7DPVR21kb4KFaAf5gFMjsO5VIsldUQm+m0IBeSvecWhV/38ATUkmZTBx1KPm7tZeKrpq6f7u1Ujk6LqwFpPkrnRnq/+eFQCuxTCZa9CfcjUeHeKg1WlvMyKysj0LI0vgRwV/64/exEIvkXWby041nucNyvGzU+IZ2ApLrJtgxXiPXnnrlHEIE66UobzlFZhgo46KhGf2MayZuhtouLJtf1b3xYe4E/jLgh/PJk0J9ZyHK1L4x4cT7Tz2R3IsRXQPyT+ufqEqQ1PL3O1DBjy1Ob3aT+kXWwpS4flbvIdI8ziUwAW6GVK+ZD57qrcN0pcvmPmHCLISIQe/dA93/SpfS1JE=
14
+ before_install:
15
+ - gem install bundler
16
+ after_success:
17
+ - bundle exec codeclimate-test-reporter
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at <richard.elias.dodson@gmail.com>. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016, 2017 Richard E. Dodson
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.
@@ -0,0 +1,40 @@
1
+ # JWT::Ext
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/jwt-ext.svg)](https://badge.fury.io/rb/jwt-ext)
4
+ [![Dependency Status](https://gemnasium.com/badges/github.com/rdodson41/ruby-jwt-ext.svg)](https://gemnasium.com/github.com/rdodson41/ruby-jwt-ext)
5
+ [![Build Status](https://travis-ci.org/rdodson41/ruby-jwt-ext.svg?branch=master)](https://travis-ci.org/rdodson41/ruby-jwt-ext)
6
+ [![Code Climate](https://codeclimate.com/github/rdodson41/ruby-jwt-ext/badges/gpa.svg)](https://codeclimate.com/github/rdodson41/ruby-jwt-ext)
7
+ [![Test Coverage](https://codeclimate.com/github/rdodson41/ruby-jwt-ext/badges/coverage.svg)](https://codeclimate.com/github/rdodson41/ruby-jwt-ext/coverage)
8
+ [![Issue Count](https://codeclimate.com/github/rdodson41/ruby-jwt-ext/badges/issue_count.svg)](https://codeclimate.com/github/rdodson41/ruby-jwt-ext)
9
+
10
+ A thin wrapper of [ruby-jwt](https://jwt.github.io/ruby-jwt), an implementation of the [RFC 7519 OAuth JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519) standard.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'jwt-ext'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install jwt-ext
27
+
28
+ ## Development
29
+
30
+ 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.
31
+
32
+ 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).
33
+
34
+ ## Contributing
35
+
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rdodson41/jwt-ext. 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.
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task default: :spec
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'jwt/ext'
5
+ require 'pry'
6
+
7
+ Pry.start
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ IFS=$'\n\t'
5
+ set -vx
6
+
7
+ bundle install
@@ -0,0 +1,35 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'jwt/ext/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'jwt-ext'
8
+ spec.version = JWT::Ext::VERSION
9
+ spec.authors = ['Richard E. Dodson']
10
+ spec.email = ['richard.elias.dodson@gmail.com']
11
+
12
+ spec.summary = 'Ruby JSON Web Token (JWT) Wrapper'
13
+ spec.homepage = 'https://github.com/rdodson41/ruby-jwt-ext'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split(/\x0/).reject do |file|
17
+ file =~ %r{^(test|spec|features)/}
18
+ end
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) do |file|
21
+ File.basename(file)
22
+ end
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.required_ruby_version = '~> 2.1'
26
+
27
+ spec.add_runtime_dependency 'jwt', '~> 1.5'
28
+
29
+ spec.add_development_dependency 'bundler', '~> 1.13'
30
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
31
+ spec.add_development_dependency 'faker', '~> 1.6'
32
+ spec.add_development_dependency 'rake', '~> 12.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.0'
34
+ spec.add_development_dependency 'simplecov', '~> 0.12'
35
+ end
@@ -0,0 +1,9 @@
1
+ require 'jwt'
2
+
3
+ module JWT
4
+ class Claims < SimpleDelegator
5
+ def encode(key:, alg:)
6
+ JWT.encode(to_h, key, alg)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ require 'jwt/encodable'
2
+
3
+ Hash.include JWT::Encodable
@@ -0,0 +1,3 @@
1
+ require 'jwt/decodable'
2
+
3
+ String.include JWT::Decodable
@@ -0,0 +1,9 @@
1
+ require 'jwt/token'
2
+
3
+ module JWT
4
+ module Decodable
5
+ def jwt
6
+ Token.new(self)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require 'jwt/claims'
2
+
3
+ module JWT
4
+ module Encodable
5
+ def jwt
6
+ Claims.new(self)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ require 'jwt/core_ext/hash'
2
+ require 'jwt/core_ext/string'
3
+ require 'jwt/claims'
4
+ require 'jwt/decodable'
5
+ require 'jwt/encodable'
6
+ require 'jwt/ext/version'
7
+ require 'jwt/token'
@@ -0,0 +1,5 @@
1
+ module JWT
2
+ module Ext
3
+ VERSION = '0.1.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'jwt'
2
+
3
+ module JWT
4
+ class Token < SimpleDelegator
5
+ def decode(key:, alg:)
6
+ JWT.decode(to_s, key, !alg.nil?, algorithm: alg).first
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jwt-ext
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Richard E. Dodson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-01 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: '1.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.13'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.13'
41
+ - !ruby/object:Gem::Dependency
42
+ name: codeclimate-test-reporter
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: faker
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '12.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '12.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.12'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.12'
111
+ description:
112
+ email:
113
+ - richard.elias.dodson@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".codeclimate.yml"
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".rubocop.yml"
122
+ - ".simplecov"
123
+ - ".travis.yml"
124
+ - CODE_OF_CONDUCT.md
125
+ - Gemfile
126
+ - LICENSE.txt
127
+ - README.md
128
+ - Rakefile
129
+ - bin/console
130
+ - bin/setup
131
+ - jwt-ext.gemspec
132
+ - lib/jwt/claims.rb
133
+ - lib/jwt/core_ext/hash.rb
134
+ - lib/jwt/core_ext/string.rb
135
+ - lib/jwt/decodable.rb
136
+ - lib/jwt/encodable.rb
137
+ - lib/jwt/ext.rb
138
+ - lib/jwt/ext/version.rb
139
+ - lib/jwt/token.rb
140
+ homepage: https://github.com/rdodson41/ruby-jwt-ext
141
+ licenses:
142
+ - MIT
143
+ metadata: {}
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '2.1'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 2.6.10
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: Ruby JSON Web Token (JWT) Wrapper
164
+ test_files: []