virgil-jwt 1.0.0
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 +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +33 -0
- data/README.md +203 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/virgil-sdk-ruby-jwt +3 -0
- data/lib/virgil/jwt.rb +14 -0
- data/lib/virgil/jwt/access_token.rb +51 -0
- data/lib/virgil/jwt/access_token_provider.rb +46 -0
- data/lib/virgil/jwt/bytes.rb +125 -0
- data/lib/virgil/jwt/caching_jwt_provider.rb +74 -0
- data/lib/virgil/jwt/callback_jwt_provider.rb +60 -0
- data/lib/virgil/jwt/const_access_token_provider.rb +56 -0
- data/lib/virgil/jwt/jwt.rb +132 -0
- data/lib/virgil/jwt/jwt_body_content.rb +110 -0
- data/lib/virgil/jwt/jwt_generator.rb +110 -0
- data/lib/virgil/jwt/jwt_header_content.rb +94 -0
- data/lib/virgil/jwt/jwt_verifier.rb +78 -0
- data/lib/virgil/jwt/token_context.rb +72 -0
- data/lib/virgil/jwt/validation.rb +59 -0
- data/lib/virgil/jwt/version.rb +5 -0
- data/virgil-jwt.gemspec +31 -0
- metadata +161 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
# Copyright (C) 2015-2019 Virgil Security Inc.
|
2
|
+
#
|
3
|
+
# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
|
4
|
+
#
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
8
|
+
# modification, are permitted provided that the following conditions are
|
9
|
+
# met:
|
10
|
+
#
|
11
|
+
# (1) Redistributions of source code must retain the above copyright
|
12
|
+
# notice, this list of conditions and the following disclaimer.
|
13
|
+
#
|
14
|
+
# (2) Redistributions in binary form must reproduce the above copyright
|
15
|
+
# notice, this list of conditions and the following disclaimer in
|
16
|
+
# the documentation and/or other materials provided with the
|
17
|
+
# distribution.
|
18
|
+
#
|
19
|
+
# (3) Neither the name of the copyright holder nor the names of its
|
20
|
+
# contributors may be used to endorse or promote products derived from
|
21
|
+
# this software without specific prior written permission.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
|
24
|
+
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
25
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
27
|
+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
28
|
+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
29
|
+
# SERVICES; LOSS OF USE, bytes, OR PROFITS; OR BUSINESS INTERRUPTION)
|
30
|
+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
31
|
+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
32
|
+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
33
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
|
35
|
+
module Virgil
|
36
|
+
module Jwt
|
37
|
+
module Validation
|
38
|
+
def self.check_array_argument!(val)
|
39
|
+
raise TypeError, 'argument must be an array' unless val.is_a?(Array)
|
40
|
+
|
41
|
+
val
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.check_filled_array_argument!(val)
|
45
|
+
check_array_argument!(val)
|
46
|
+
raise ArgumentError, 'argument must not be an empty array' if val.empty?
|
47
|
+
|
48
|
+
val
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.check_type_argument!(cclass, val)
|
52
|
+
raise TypeError, "argument must have type #{cclass.name}" unless val.is_a?(cclass)
|
53
|
+
|
54
|
+
val
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/virgil-jwt.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "virgil/jwt/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "virgil-jwt"
|
8
|
+
spec.version = Virgil::Jwt::VERSION
|
9
|
+
spec.authors = ["Vasilina Bezuglaya"]
|
10
|
+
spec.email = ["vbezuglaya@virgilsecurity.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Virgil JWT}
|
13
|
+
spec.description = %q{Virgil JSON Web Token to make call to Virgil Services}
|
14
|
+
spec.homepage = "https://github.com/VirgilSecurity/virgil-sdk-ruby/tree/jwt-v5"
|
15
|
+
spec.license = "BSD-3-Clause"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
27
|
+
spec.add_development_dependency "minitest-reporters", "~> 1.1"
|
28
|
+
spec.add_development_dependency 'envyable', '~> 1.2'
|
29
|
+
spec.add_development_dependency 'virgil-crypto', '~> 3.6', '>= 3.6.2'
|
30
|
+
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: virgil-jwt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vasilina Bezuglaya
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-reporters
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: envyable
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.2'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: virgil-crypto
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.6'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 3.6.2
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '3.6'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 3.6.2
|
103
|
+
description: Virgil JSON Web Token to make call to Virgil Services
|
104
|
+
email:
|
105
|
+
- vbezuglaya@virgilsecurity.net
|
106
|
+
executables:
|
107
|
+
- virgil-sdk-ruby-jwt
|
108
|
+
extensions: []
|
109
|
+
extra_rdoc_files: []
|
110
|
+
files:
|
111
|
+
- ".gitignore"
|
112
|
+
- ".travis.yml"
|
113
|
+
- Gemfile
|
114
|
+
- Gemfile.lock
|
115
|
+
- LICENSE.txt
|
116
|
+
- README.md
|
117
|
+
- Rakefile
|
118
|
+
- bin/console
|
119
|
+
- bin/setup
|
120
|
+
- exe/virgil-sdk-ruby-jwt
|
121
|
+
- lib/virgil/jwt.rb
|
122
|
+
- lib/virgil/jwt/access_token.rb
|
123
|
+
- lib/virgil/jwt/access_token_provider.rb
|
124
|
+
- lib/virgil/jwt/bytes.rb
|
125
|
+
- lib/virgil/jwt/caching_jwt_provider.rb
|
126
|
+
- lib/virgil/jwt/callback_jwt_provider.rb
|
127
|
+
- lib/virgil/jwt/const_access_token_provider.rb
|
128
|
+
- lib/virgil/jwt/jwt.rb
|
129
|
+
- lib/virgil/jwt/jwt_body_content.rb
|
130
|
+
- lib/virgil/jwt/jwt_generator.rb
|
131
|
+
- lib/virgil/jwt/jwt_header_content.rb
|
132
|
+
- lib/virgil/jwt/jwt_verifier.rb
|
133
|
+
- lib/virgil/jwt/token_context.rb
|
134
|
+
- lib/virgil/jwt/validation.rb
|
135
|
+
- lib/virgil/jwt/version.rb
|
136
|
+
- virgil-jwt.gemspec
|
137
|
+
homepage: https://github.com/VirgilSecurity/virgil-sdk-ruby/tree/jwt-v5
|
138
|
+
licenses:
|
139
|
+
- BSD-3-Clause
|
140
|
+
metadata: {}
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
requirements: []
|
156
|
+
rubyforge_project:
|
157
|
+
rubygems_version: 2.7.3
|
158
|
+
signing_key:
|
159
|
+
specification_version: 4
|
160
|
+
summary: Virgil JWT
|
161
|
+
test_files: []
|