jwt_api_auth 0.0.1.pre.6 → 0.0.1.pre.7

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: 2d8037fc592eeb8985d15ec714a79a760a72070833fe199743305896af28c702
4
- data.tar.gz: 03a845d6521ccecf8d91040ab1fcb7434efea54109d25b3c640c310bcd804574
3
+ metadata.gz: 28b2ffb88b8c174666626ded4fd860ae53e959f5ea7175fa8da868082760f48c
4
+ data.tar.gz: fdd742dd754b19af9b1049d03a1ee808f8c1b6948c13f1edaa49aa59e2f07f48
5
5
  SHA512:
6
- metadata.gz: 4b1438eb75ae7ed255d706eaf4dadc15d4e1cc33776d810f876cdca6ccd4cfc5c41448381aec35b908bfe04fddf9959f720b147c5b30b4d7354fee49f67c2a79
7
- data.tar.gz: d2fef5f4aee3a28517ba36ef5443594c0562bf7a77440fd5199324e4b26f08e259971081556d04381261fa81f073a895b6fe41b840ece729032ba7cfc77e74c3
6
+ metadata.gz: 1fa57315afa1679b7697d3f9b89c31ff0b78477c20d357b1ae13d407fdc2484998ec3bb75d80cbc49e439eef08d84dc3a69a581af8107f453040113efa663ac8
7
+ data.tar.gz: 58bc3d32d241422879b91eae44926b6d4225422698dce01e0483b7bda0b3967731aefc562e13589d9cc214cc5017e8c3c38da16ae1159284bfed4c76c1b8cf7f
@@ -16,7 +16,14 @@ module JwtApiAuth
16
16
 
17
17
  def authenticate_user
18
18
  token = request.headers['Authorization']&.split('Bearer ')&.last
19
- ::JWT.decode token, JwtApiAuth.token_secret.call, true, { algorithm: 'HS256' }
19
+ options = { algorithm: 'HS256' }
20
+
21
+ if JwtApiAuth.token_audience.present?
22
+ options[:aud] = JwtApiAuth.token_audience.map(&:to_s)
23
+ options[:verify_aud] = true
24
+ end
25
+
26
+ ::JWT.decode token, JwtApiAuth.token_secret.call, true, options
20
27
 
21
28
  head :unauthorized unless token
22
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JwtApiAuth
4
- VERSION = '0.0.1.pre.6'
4
+ VERSION = '0.0.1.pre.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwt_api_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre.6
4
+ version: 0.0.1.pre.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristian Stügelmayer