jwt-auth_zero 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +20 -0
- data/README.md +88 -0
- data/lib/jwt/auth_zero.rb +11 -0
- data/lib/jwt/auth_zero/configuration.rb +61 -0
- data/lib/jwt/auth_zero/decode.rb +11 -0
- data/lib/jwt/auth_zero/identity.rb +16 -0
- data/lib/tasks/console.rake +8 -0
- data/lib/tasks/rubocop.rake +7 -0
- data/lib/tasks/test.rake +8 -0
- metadata +181 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a2ed3b3c25d8afe4be60b43d5d6f616bd5e162c0
|
4
|
+
data.tar.gz: 0407ef6b67ae7e5e735e3928bc430f95244fdd86
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d639637bb71effb4a34d303995b1da78bf133346ac31e3b93e79ed2f65ca38fd38344ffaff114254e9437eb7f15518e67b18e610698468bc17ccc572eea33884
|
7
|
+
data.tar.gz: f2e0f55948fbd231fc02ea46aff97aab6e2afe65edd8a221e8c99dea488edc082ea4809123bfd0e40640a375c030beb11a320378c7b1c91603f5fbc8e21efea7
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2016 []().
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# JWT::AuthZero
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/jwt-auth_zero.svg)](http://badge.fury.io/rb/jwt-auth_zero)
|
4
|
+
[![Code Climate GPA](https://codeclimate.com/github/tangrufus/jwt-auth_zero.svg)](https://codeclimate.com/github/tangrufus/jwt-auth_zero)
|
5
|
+
[![Code Climate Coverage](https://codeclimate.com/github/tangrufus/jwt-auth_zero/coverage.svg)](https://codeclimate.com/github/tangrufus/jwt-auth_zero)
|
6
|
+
[![Gemnasium Status](https://gemnasium.com/tangrufus/jwt-auth_zero.svg)](https://gemnasium.com/tangrufus/jwt-auth_zero)
|
7
|
+
[![Travis CI Status](https://secure.travis-ci.org/tangrufus/jwt-auth_zero.svg)](https://travis-ci.org/tangrufus/jwt-auth_zero)
|
8
|
+
[![Patreon](https://img.shields.io/badge/patreon-donate-brightgreen.svg)](https://www.patreon.com/)
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
13
|
+
|
14
|
+
# Table of Contents
|
15
|
+
|
16
|
+
- [Features](#features)
|
17
|
+
- [Screencasts](#screencasts)
|
18
|
+
- [Requirements](#requirements)
|
19
|
+
- [Setup](#setup)
|
20
|
+
- [Usage](#usage)
|
21
|
+
- [Versioning](#versioning)
|
22
|
+
- [Code of Conduct](#code-of-conduct)
|
23
|
+
- [Contributions](#contributions)
|
24
|
+
- [License](#license)
|
25
|
+
- [History](#history)
|
26
|
+
- [Credits](#credits)
|
27
|
+
|
28
|
+
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
29
|
+
|
30
|
+
# Features
|
31
|
+
|
32
|
+
# Screencasts
|
33
|
+
|
34
|
+
# Requirements
|
35
|
+
|
36
|
+
0. [MRI 2.3.1](https://www.ruby-lang.org)
|
37
|
+
|
38
|
+
# Setup
|
39
|
+
|
40
|
+
For a secure install, type the following (recommended):
|
41
|
+
|
42
|
+
gem cert --add <(curl --location --silent /gem-public.pem)
|
43
|
+
gem install jwt-auth_zero --trust-policy MediumSecurity
|
44
|
+
|
45
|
+
NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification while
|
46
|
+
allowing the installation of unsigned dependencies since they are beyond the scope of this gem.
|
47
|
+
|
48
|
+
For an insecure install, type the following (not recommended):
|
49
|
+
|
50
|
+
gem install jwt-auth_zero
|
51
|
+
|
52
|
+
Add the following to your Gemfile:
|
53
|
+
|
54
|
+
gem "jwt-auth_zero"
|
55
|
+
|
56
|
+
# Usage
|
57
|
+
|
58
|
+
|
59
|
+
# Versioning
|
60
|
+
|
61
|
+
Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
|
62
|
+
|
63
|
+
- Patch (x.y.Z) - Incremented for small, backwards compatible bug fixes.
|
64
|
+
- Minor (x.Y.z) - Incremented for new, backwards compatible public API enhancements and/or bug fixes.
|
65
|
+
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
66
|
+
|
67
|
+
# Code of Conduct
|
68
|
+
|
69
|
+
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By participating in this project
|
70
|
+
you agree to abide by its terms.
|
71
|
+
|
72
|
+
# Contributions
|
73
|
+
|
74
|
+
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
75
|
+
|
76
|
+
# License
|
77
|
+
|
78
|
+
Copyright (c) 2016 [Tang Rufus](mailto:tangrufus@gmail.com).
|
79
|
+
Read the [LICENSE](LICENSE.md) for details.
|
80
|
+
|
81
|
+
# History
|
82
|
+
|
83
|
+
Read the [CHANGELOG](CHANGELOG.md) for details.
|
84
|
+
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
85
|
+
|
86
|
+
# Credits
|
87
|
+
|
88
|
+
Developed by [Tang Rufus](https://www.github.com/tangrufus) at [Hearda](https://www.hearda.com).
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module JWT
|
4
|
+
module AuthZero
|
5
|
+
class << self
|
6
|
+
extend Forwardable
|
7
|
+
|
8
|
+
attr_writer :configuration
|
9
|
+
def_delegators :@configuration, :client_secret, :decode_options
|
10
|
+
|
11
|
+
def configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def reset!
|
16
|
+
@configuration = Configuration.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def configure
|
20
|
+
yield(configuration)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Configuration
|
26
|
+
attr_writer :client_id, :client_domain, :client_secret
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
@client_id = nil
|
30
|
+
@client_domain = nil
|
31
|
+
@client_secret = nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def decode_options
|
35
|
+
ensure_decode_options_present
|
36
|
+
{
|
37
|
+
iss: @client_domain,
|
38
|
+
aud: @client_id,
|
39
|
+
verify_iss: true,
|
40
|
+
verify_aud: true,
|
41
|
+
verify_iat: true,
|
42
|
+
algorithm: 'HS256'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def client_secret
|
47
|
+
raise 'Missing "client_secret" for JWT::AuthZero' if @client_secret.nil?
|
48
|
+
@client_secret
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def ensure_decode_options_present
|
54
|
+
return unless @client_domain.nil? || @client_id.nil?
|
55
|
+
|
56
|
+
raise 'Missing "client_domain" and "client_id" for JWT::AuthZero' if @client_domain.nil? && @client_id.nil?
|
57
|
+
raise 'Missing "client_domain" for JWT::AuthZero' if @client_domain.nil?
|
58
|
+
raise 'Missing "client_id" for JWT::AuthZero'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/tasks/test.rake
ADDED
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jwt-auth_zero
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tang Rufus
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-25 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.3.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.3.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: appraisal
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 2.1.0
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.1.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.12'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.12'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '11.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '11.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: gemsmith
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '7.7'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '7.7'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rubocop
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0.40'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.40'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: codeclimate-test-reporter
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.6.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 0.6.0
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: minitest
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '5.9'
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 5.9.1
|
127
|
+
type: :development
|
128
|
+
prerelease: false
|
129
|
+
version_requirements: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - "~>"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '5.9'
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: 5.9.1
|
137
|
+
description: JWT::AuthZero is a lightweight wrapper for the JWT gem that decodes Auth0
|
138
|
+
tokens for you.
|
139
|
+
email:
|
140
|
+
- tangrufus@gmail.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files:
|
144
|
+
- README.md
|
145
|
+
- LICENSE.md
|
146
|
+
files:
|
147
|
+
- LICENSE.md
|
148
|
+
- README.md
|
149
|
+
- lib/jwt/auth_zero.rb
|
150
|
+
- lib/jwt/auth_zero/configuration.rb
|
151
|
+
- lib/jwt/auth_zero/decode.rb
|
152
|
+
- lib/jwt/auth_zero/identity.rb
|
153
|
+
- lib/tasks/console.rake
|
154
|
+
- lib/tasks/rubocop.rake
|
155
|
+
- lib/tasks/test.rake
|
156
|
+
homepage: https://github.com/tangrufus/jwt-auth_zero
|
157
|
+
licenses:
|
158
|
+
- MIT
|
159
|
+
metadata:
|
160
|
+
allowed_push_host: https://rubygems.org
|
161
|
+
post_install_message:
|
162
|
+
rdoc_options: []
|
163
|
+
require_paths:
|
164
|
+
- lib
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 2.6.7
|
178
|
+
signing_key:
|
179
|
+
specification_version: 4
|
180
|
+
summary: Seamless JWT decoding for Auth0
|
181
|
+
test_files: []
|