keycardai-oauth 0.8.1 → 0.9.1

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: 9b06d9181e8d3dfbae0c141bcc8b4ffd4850f49f247fd3115ac3b8aa2a745920
4
- data.tar.gz: 2b698ca8fa9dd2f0d002148aa3d54698fd48a43b2666356b358d5db749ea5402
3
+ metadata.gz: 6d082f18fb1a1d930cd99544d71e2aac6bc2ecb8d6925441cf1edc0ae2ccea71
4
+ data.tar.gz: e50e8e4a1927a294bb9bfc37f22e493e110c4d19f37509114fc3bbf692ff5d79
5
5
  SHA512:
6
- metadata.gz: 36a13be3a6755509270f5aa88d06ea093a31c9c3191c66c85c6249829d56d0672d0e4d454ca738c5d2d00318d927055d2bb5fd280391fc622f2e9cd329e24441
7
- data.tar.gz: ebeb9a7e16fd639899d677ebd00d83f987a8993d68d02be5e1eefdcd1abc60c8d53b1d4e4c51d19f4c635136e54847bc6c5533c22842b5a81d777ce3c0981b04
6
+ metadata.gz: c6b25688f8ca096390ca74317e36e6cb76d4f26eecbd3c8e2f21e4f2553efb10c57d254982e9fb92c66910bffe9acdcbd97d79caa764493fc1f8d4fe6e6004eb
7
+ data.tar.gz: 4b176b3d323367a7bceb4f96a5b89f2417454bcc431da20779791a5af9c5629801ab66e1f09f6deb893a20d1e65a6e488f5ec236cc85198165f9b4ead441d408
data/CHANGELOG.md CHANGED
@@ -15,6 +15,20 @@ the loopback flow (RFC 8252), JWT signing and verification with a caching JWKS
15
15
  keyring, the three application credentials (ClientSecret with multi-zone,
16
16
  WebIdentity, WorkloadIdentity with pluggable token sources), and AccessContext.
17
17
 
18
+ ## 0.9.1-keycardai-oauth (2026-11-25)
19
+
20
+
21
+ - fix(keycardai-oauth): normalize the verified caller audience (#75)
22
+ - Co-authored-by: devin-ai-keycard <devin-ai@keycard.ai>
23
+ Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
24
+
25
+ ## 0.9.0-keycardai-oauth (2026-11-25)
26
+
27
+
28
+ - feat(keycardai-oauth): preserve authorization server error reasons (#74)
29
+ - Co-authored-by: devin-ai-keycard <devin-ai@keycard.ai>
30
+ Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
31
+
18
32
  ## 0.8.1-keycardai-oauth (2026-11-25)
19
33
 
20
34
 
@@ -29,20 +29,30 @@ module Keycardai
29
29
  end
30
30
 
31
31
  # An OAuth error response from the authorization server (RFC 6749 §5.2).
32
- # Has the wire error code plus the optional description and URI.
32
+ # Has the wire error code plus the optional description, URI, and reason.
33
33
  class OAuthError < HTTPError
34
+ PERMANENT_ERROR_CODES = %w[access_denied expired_token insufficient_authorization invalid_client].freeze
35
+
34
36
  # @return [String] the OAuth error code (e.g. invalid_grant)
35
37
  attr_reader :error
36
38
  # @return [String, nil]
37
39
  attr_reader :error_description
38
40
  # @return [String, nil]
39
41
  attr_reader :error_uri
42
+ # @return [String, nil]
43
+ attr_reader :reason
40
44
 
41
- def initialize(message, error:, status:, body: "", error_description: nil, error_uri: nil)
45
+ def initialize(message, error:, status:, body: "", error_description: nil, error_uri: nil, reason: nil)
42
46
  super(message, status: status, body: body)
43
47
  @error = error
44
48
  @error_description = error_description
45
49
  @error_uri = error_uri
50
+ @reason = reason
51
+ end
52
+
53
+ # @return [Boolean] whether repeating the request unchanged could succeed
54
+ def retryable?
55
+ status == 429 || status.to_i >= 500 || !PERMANENT_ERROR_CODES.include?(error)
46
56
  end
47
57
  end
48
58
 
@@ -57,7 +57,8 @@ module Keycardai
57
57
 
58
58
  OAuthError.new("#{endpoint_name} returned #{payload["error"]}",
59
59
  error: payload["error"], error_description: payload["error_description"],
60
- error_uri: payload["error_uri"], status: response.status, body: response.body)
60
+ error_uri: payload["error_uri"], reason: payload["reason"],
61
+ status: response.status, body: response.body)
61
62
  end
62
63
 
63
64
  private
@@ -138,6 +138,8 @@ module Keycardai
138
138
  def verify_against(issuers, token)
139
139
  claims = JWTVerifier.new(issuers: issuers, keyring: @keyring, audiences: @audiences,
140
140
  clock: @clock).verify(token)
141
+ audience = claims["aud"]
142
+ claims = claims.merge("aud" => [audience]) if audience.is_a?(String)
141
143
  AccessToken.new(token: token, claims: claims)
142
144
  end
143
145
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Keycardai
4
4
  module OAuth
5
- VERSION = "0.8.1"
5
+ VERSION = "0.9.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycardai-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keycard