usps-jwt_auth 0.0.6 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3713e69b0474983072c09952260c509b4d5bfc55093f784180c2762f1580c22
4
- data.tar.gz: 3b211bb26c1ba938aa104439bd399ebd48369a02b7a9476b5b89d557219f4b86
3
+ metadata.gz: 0ddea1f98fbb165c79f536db7ab0d4ed3b204a17b7303bccab87220e8017e3a8
4
+ data.tar.gz: 329fb076facded9670e1be83e8d364ee52eb0be4627e697c64b22168df63621e
5
5
  SHA512:
6
- metadata.gz: '09cde55ca936565d0fd67906a8324ec1dd320628a18d99ad126fa720352598480729f068cf8a657254e4f57d22596eee5fa2aed2c9af8e4d54bf32d90c9111ea'
7
- data.tar.gz: 5d97c3ccc7b24ef48c67dd82195229cc2f69b3f975dbab5f21af9f4b31e5765c4b45b9f532a1114cb83132ccd2910086288a0f76cb7bd93b228091c020a749fa
6
+ metadata.gz: a5be24396c8ea03725dcff139aa529d91f36ee5b5959ea04fa6c3c505da79e392c7840251e899418b03651de61bac8585a3c502cc2a5682b180a1d23be26bdcd
7
+ data.tar.gz: 87cca2f7e7cd2db312a960390ef2fc8d6e139ac5c9e6ce94295f5d0f9cb10bac0370de4bf453788c09dc7c9f612c855ef1a879490976e578aa7b246776cb2351
@@ -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('/.keep'))
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('/.keep'))
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 "\n"
16
- file.puts Usps::JwtAuth.configuration.keys_path
17
- file.puts "!#{Usps::JwtAuth.configuration.keys_path.join('/.keep')}"
18
- file.puts Usps::JwtAuth.configuration.public_keys_path
19
- file.puts "!#{Usps::JwtAuth.configuration.public_keys_path.join('/.keep')}"
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
@@ -4,10 +4,10 @@ module Usps
4
4
  module JwtAuth
5
5
  # Configure JWT Authentication
6
6
  #
7
- module Config
8
- attr_accessor :keys_path, :public_keys_path, :environment
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::OrderedOptions.new(
29
+ @jwt = ActiveSupport::InheritableOptions.new(
22
30
  {
23
31
  issuer_base: 'usps:1',
24
32
  issuers: [],
@@ -11,7 +11,7 @@ module Usps
11
11
 
12
12
  rake_tasks do
13
13
  path = File.expand_path(__dir__)
14
- Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
14
+ Dir.glob("#{path}/../../tasks/**/*.rake").each { |f| load f }
15
15
  end
16
16
  end
17
17
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module JwtAuth
5
- VERSION = '0.0.6'
5
+ VERSION = '0.0.8'
6
6
  end
7
7
  end
data/lib/usps/jwt_auth.rb CHANGED
@@ -7,7 +7,7 @@ require_relative 'jwt_auth/encode'
7
7
  require_relative 'jwt_auth/decode'
8
8
  require_relative 'jwt_auth/concern'
9
9
 
10
- require_relative 'jwt_auth/railtie' if defined?(Rails)
10
+ require 'usps/jwt_auth/railtie' if defined?(Rails)
11
11
 
12
12
  module Usps
13
13
  # Unified configuration for handling JWT Authentication
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.6
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: '0'
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: '0'
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