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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/app/controllers/masks/rails/logouts_controller.rb +3 -3
- data/app/controllers/masks/rails/sessions_controller.rb +4 -26
- data/lib/masks/client/claims.rb +4 -9
- data/lib/masks/client/delegations.rb +16 -14
- data/lib/masks/client/device.rb +1 -1
- data/lib/masks/client/embedded.rb +3 -3
- data/lib/masks/client/enrollment.rb +1 -1
- data/lib/masks/client/errors.rb +72 -32
- data/lib/masks/client/failures.rb +81 -0
- data/lib/masks/client/handshake.rb +2 -2
- data/lib/masks/client/http.rb +15 -15
- data/lib/masks/client/id_token.rb +35 -0
- data/lib/masks/client/introspection.rb +2 -2
- data/lib/masks/client/issuer.rb +4 -7
- data/lib/masks/client/logout.rb +6 -12
- data/lib/masks/client/proof.rb +23 -22
- data/lib/masks/client/rack.rb +3 -3
- data/lib/masks/client/registration.rb +1 -1
- data/lib/masks/client/resource.rb +12 -13
- data/lib/masks/client/session.rb +16 -10
- data/lib/masks/client/tokens.rb +1 -1
- data/lib/masks/client/transport.rb +1 -1
- data/lib/masks/client/verifier.rb +53 -17
- data/lib/masks/client.rb +3 -0
- data/lib/masks/rails/authentication.rb +7 -7
- data/lib/masks/rails/cache.rb +6 -8
- data/lib/masks/rails/configuration.rb +5 -1
- data/lib/masks/rails/protected_resource.rb +8 -6
- data/lib/masks/version.rb +1 -1
- metadata +3 -1
|
@@ -6,7 +6,7 @@ module Masks
|
|
|
6
6
|
include Masks::Rails::Privileged
|
|
7
7
|
|
|
8
8
|
included do
|
|
9
|
-
rescue_from Masks::Client::
|
|
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::
|
|
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::
|
|
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
|
|
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::
|
|
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
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.
|
|
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
|