usps-jwt_auth 0.0.5 → 0.0.8
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/lib/tasks/jwt_auth.rake +8 -7
- data/lib/usps/jwt_auth/config.rb +12 -4
- data/lib/{railtie.rb → usps/jwt_auth/railtie.rb} +5 -1
- data/lib/usps/jwt_auth/version.rb +1 -1
- data/lib/usps/jwt_auth.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ddea1f98fbb165c79f536db7ab0d4ed3b204a17b7303bccab87220e8017e3a8
|
|
4
|
+
data.tar.gz: 329fb076facded9670e1be83e8d364ee52eb0be4627e697c64b22168df63621e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5be24396c8ea03725dcff139aa529d91f36ee5b5959ea04fa6c3c505da79e392c7840251e899418b03651de61bac8585a3c502cc2a5682b180a1d23be26bdcd
|
|
7
|
+
data.tar.gz: 87cca2f7e7cd2db312a960390ef2fc8d6e139ac5c9e6ce94295f5d0f9cb10bac0370de4bf453788c09dc7c9f612c855ef1a879490976e578aa7b246776cb2351
|
data/lib/tasks/jwt_auth.rake
CHANGED
|
@@ -6,17 +6,18 @@ namespace :usps do
|
|
|
6
6
|
task install: :environment do
|
|
7
7
|
# Ensure keys directories exist
|
|
8
8
|
FileUtils.mkdir_p(Usps::JwtAuth.configuration.keys_path)
|
|
9
|
-
FileUtils.touch(Usps::JwtAuth.configuration.keys_path.join('
|
|
9
|
+
FileUtils.touch(Usps::JwtAuth.configuration.keys_path.join('.keep'))
|
|
10
10
|
FileUtils.mkdir_p(Usps::JwtAuth.configuration.public_keys_path)
|
|
11
|
-
FileUtils.touch(Usps::JwtAuth.configuration.public_keys_path.join('
|
|
11
|
+
FileUtils.touch(Usps::JwtAuth.configuration.public_keys_path.join('.keep'))
|
|
12
12
|
|
|
13
13
|
# Ignore keys directories from git
|
|
14
14
|
File.open('.gitignore', 'a') do |file|
|
|
15
|
-
file.puts
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
file.puts <<~IGNORE
|
|
16
|
+
/#{Usps::JwtAuth.configuration.keys_path}
|
|
17
|
+
/!#{Usps::JwtAuth.configuration.keys_path.join('.keep')}
|
|
18
|
+
/#{Usps::JwtAuth.configuration.public_keys_path}
|
|
19
|
+
/!#{Usps::JwtAuth.configuration.public_keys_path.join('.keep')}
|
|
20
|
+
IGNORE
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
end
|
data/lib/usps/jwt_auth/config.rb
CHANGED
|
@@ -4,10 +4,10 @@ module Usps
|
|
|
4
4
|
module JwtAuth
|
|
5
5
|
# Configure JWT Authentication
|
|
6
6
|
#
|
|
7
|
-
|
|
8
|
-
attr_accessor :
|
|
7
|
+
class Config
|
|
8
|
+
attr_accessor :environment
|
|
9
9
|
attr_writer :key_size
|
|
10
|
-
attr_reader :jwt
|
|
10
|
+
attr_reader :keys_path, :public_keys_path, :jwt
|
|
11
11
|
|
|
12
12
|
def initialize
|
|
13
13
|
yield self if block_given?
|
|
@@ -17,8 +17,16 @@ module Usps
|
|
|
17
17
|
@key_size || 4096
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
def keys_path=(path)
|
|
21
|
+
@keys_path = path.is_a?(Pathname) ? path : Pathname.new(path)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def public_keys_path=(path)
|
|
25
|
+
@public_keys_path = path.is_a?(Pathname) ? path : Pathname.new(path)
|
|
26
|
+
end
|
|
27
|
+
|
|
20
28
|
def jwt=(hash)
|
|
21
|
-
@jwt = ActiveSupport::
|
|
29
|
+
@jwt = ActiveSupport::InheritableOptions.new(
|
|
22
30
|
{
|
|
23
31
|
issuer_base: 'usps:1',
|
|
24
32
|
issuers: [],
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rails'
|
|
2
4
|
|
|
3
5
|
module Usps
|
|
4
6
|
module JwtAuth
|
|
7
|
+
# Expose rake tasks to Rails
|
|
8
|
+
#
|
|
5
9
|
class Railtie < Rails::Railtie
|
|
6
10
|
railtie_name :usps_jwt_auth
|
|
7
11
|
|
|
8
12
|
rake_tasks do
|
|
9
13
|
path = File.expand_path(__dir__)
|
|
10
|
-
Dir.glob("#{path}
|
|
14
|
+
Dir.glob("#{path}/../../tasks/**/*.rake").each { |f| load f }
|
|
11
15
|
end
|
|
12
16
|
end
|
|
13
17
|
end
|
data/lib/usps/jwt_auth.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usps-jwt_auth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Fiander
|
|
@@ -13,16 +13,16 @@ dependencies:
|
|
|
13
13
|
name: jwt
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '3.1'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
|
-
- - "
|
|
23
|
+
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '3.1'
|
|
26
26
|
description: JWT authentication for USPS applications deployed to AWS
|
|
27
27
|
email:
|
|
28
28
|
- jsfiander@gmail.com
|
|
@@ -33,13 +33,13 @@ files:
|
|
|
33
33
|
- ".ruby-version"
|
|
34
34
|
- README.md
|
|
35
35
|
- Rakefile
|
|
36
|
-
- lib/railtie.rb
|
|
37
36
|
- lib/tasks/jwt_auth.rake
|
|
38
37
|
- lib/usps/jwt_auth.rb
|
|
39
38
|
- lib/usps/jwt_auth/concern.rb
|
|
40
39
|
- lib/usps/jwt_auth/config.rb
|
|
41
40
|
- lib/usps/jwt_auth/decode.rb
|
|
42
41
|
- lib/usps/jwt_auth/encode.rb
|
|
42
|
+
- lib/usps/jwt_auth/railtie.rb
|
|
43
43
|
- lib/usps/jwt_auth/version.rb
|
|
44
44
|
- sig/usps_jwt/auth.rbs
|
|
45
45
|
homepage: https://www.usps.org
|