masks 0.12.2 → 0.13.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.
@@ -6,7 +6,7 @@ module Masks
6
6
  include Masks::Rails::Privileged
7
7
 
8
8
  included do
9
- rescue_from Masks::Client::ReplayUnavailable, with: :masks_unavailable if respond_to?(:rescue_from)
9
+ rescue_from Masks::Client::Unavailable, with: :masks_unavailable if respond_to?(:rescue_from)
10
10
  end
11
11
 
12
12
  def masks_resource
@@ -25,7 +25,9 @@ module Masks
25
25
  def masks_authenticate(scope: nil, role: nil, organization: nil)
26
26
  masks_resource.authenticate(request.authorization, scope: scope, role: role, organization: organization,
27
27
  **masks_proof)
28
- rescue Masks::Client::Unauthenticated
28
+ rescue Masks::Client::InvalidToken => e
29
+ raise unless e.missing?
30
+
29
31
  nil
30
32
  end
31
33
 
@@ -34,15 +36,15 @@ module Masks
34
36
  end
35
37
 
36
38
  def masks_challenge(error)
37
- error = Masks::Client::Unauthorized.new(error.to_s) unless error.is_a?(Masks::Client::Challenge)
39
+ error = Masks::Client::InvalidToken.new(error.to_s) unless error.is_a?(Masks::Client::Error)
38
40
 
39
41
  response.headers["WWW-Authenticate"] = masks_resource.challenge(error)
40
42
  response.headers["Cache-Control"] = "no-store"
41
43
 
42
44
  render json: {
43
- "error" => error.code || "invalid_token",
45
+ "error" => error.code,
44
46
  "error_description" => error.description
45
- }, status: error.status
47
+ }, status: error.status || 401
46
48
  end
47
49
 
48
50
  def masks_unavailable
@@ -72,7 +74,7 @@ module Masks
72
74
 
73
75
  @masks_token_claims = claims
74
76
  true
75
- rescue Masks::Client::Challenge => e
77
+ rescue Masks::Client::InvalidToken, Masks::Client::Forbidden => e
76
78
  masks_challenge(e)
77
79
  false
78
80
  end
data/lib/masks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Masks
2
- VERSION = "0.12.2".freeze
2
+ VERSION = "0.13.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - the masks authors
@@ -55,8 +55,10 @@ files:
55
55
  - lib/masks/client/embedded.rb
56
56
  - lib/masks/client/enrollment.rb
57
57
  - lib/masks/client/errors.rb
58
+ - lib/masks/client/failures.rb
58
59
  - lib/masks/client/handshake.rb
59
60
  - lib/masks/client/http.rb
61
+ - lib/masks/client/id_token.rb
60
62
  - lib/masks/client/introspection.rb
61
63
  - lib/masks/client/issuer.rb
62
64
  - lib/masks/client/key.rb