usps-jwt_auth 0.0.8 → 0.0.10

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: 0ddea1f98fbb165c79f536db7ab0d4ed3b204a17b7303bccab87220e8017e3a8
4
- data.tar.gz: 329fb076facded9670e1be83e8d364ee52eb0be4627e697c64b22168df63621e
3
+ metadata.gz: 5d14f7554e39b47abbbcff759dbfedbc8baa4f58719a83be6d328d69fc3c36dd
4
+ data.tar.gz: 9d0b6800d14f0d00a2db2205e8055a96da6ebccf332a93f823eb7f9da3721854
5
5
  SHA512:
6
- metadata.gz: a5be24396c8ea03725dcff139aa529d91f36ee5b5959ea04fa6c3c505da79e392c7840251e899418b03651de61bac8585a3c502cc2a5682b180a1d23be26bdcd
7
- data.tar.gz: 87cca2f7e7cd2db312a960390ef2fc8d6e139ac5c9e6ce94295f5d0f9cb10bac0370de4bf453788c09dc7c9f612c855ef1a879490976e578aa7b246776cb2351
6
+ metadata.gz: 55ee80a439967cfba8d1ae82c5bb4d3e11f95897dbd614a47eeae663086257637f71c9daf5464496670aac46402cf9e6be2779f0cfbb59fdcc21584ad0dfd830
7
+ data.tar.gz: fa247b4190a9aef54e9bd066f7c0d469284a32b52f8537d0c19ca936b56d4a873ee5e7e937704576d6b0e991d639e13bb2023ecb161a2a34fd970f09e642b050
data/README.md CHANGED
@@ -4,8 +4,16 @@
4
4
 
5
5
  ## Installation
6
6
 
7
+ Add the gem to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'usps-jwt_auth', '>= 0.0.9'
11
+ ```
12
+
13
+ Then run the install task:
14
+
7
15
  ```sh
8
- bundle exec rake usps:jwt:install
16
+ bundle exec rails usps:jwt:install
9
17
  ```
10
18
 
11
19
  ## Configuration
@@ -13,8 +21,8 @@ bundle exec rake usps:jwt:install
13
21
  ```ruby
14
22
  Usps::JwtAuth.configure do |config|
15
23
  config.environment = Rails.env
16
- config.keys_path = Rails.root.join('config/keys')
17
- config.public_keys_path = Rails.root.join('config/public_keys')
24
+ config.keys_path = 'config/keys'
25
+ config.public_keys_path = 'config/public_keys'
18
26
 
19
27
  config.jwt = {
20
28
  audience: ENV.fetch('JWT_AUDIENCE'),
@@ -23,3 +31,16 @@ Usps::JwtAuth.configure do |config|
23
31
  }
24
32
  end
25
33
  ```
34
+
35
+ ## Usage
36
+
37
+ ```ruby
38
+ class ApplicationController < ActionController::Base
39
+ include Usps::JwtAuth::Concern
40
+
41
+ before_action :authenticate_user_from_jwt!
42
+ # skip_before_action :authenticate_user_from_jwt!, only: %i[]
43
+
44
+ # ...
45
+ end
46
+ ```
@@ -114,7 +114,7 @@ module Usps
114
114
  store_jwt(
115
115
  Encode.encode(
116
116
  { certificate: ENV['STUB_CERTIFICATE'].presence || 'E123456' },
117
- audience: [JwtAuth.configuration.jwt.audience], issuer: JwtAuth.configuration.issuers.first
117
+ audience: [JwtAuth.configuration.jwt.audience], issuer: JwtAuth.configuration.jwt.issuers.first
118
118
  )
119
119
  )
120
120
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module JwtAuth
5
- VERSION = '0.0.8'
5
+ VERSION = '0.0.10'
6
6
  end
7
7
  end
data/lib/usps/jwt_auth.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'jwt'
4
+
3
5
  # Internal requires
4
6
  require_relative 'jwt_auth/version'
5
7
  require_relative 'jwt_auth/config'
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.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander