keycardai-oauth 0.9.2 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73096603402556204c3aa921c4821cbb250b662d957c6ead112dd28658dd303b
4
- data.tar.gz: 53a912a76ea3194c4a78273ad494b6cde5e06591bbb429b0a310ea6bd401baa3
3
+ metadata.gz: 013a407a3595ae3e9b735f95e216187d3534d9ff9cf52298cbd4071a1cd92994
4
+ data.tar.gz: 33080c7a3643832e8601d5d20eb95fec4fd556d2e69cacb984772da6f6dc7e4b
5
5
  SHA512:
6
- metadata.gz: f61479a708c6423eed6139eccedea61332023e16edc1bbacf1424908492db43b5535c85550b700ffdbaf3648e0ad0859406652cfa4abbda3b03ba5925e75952f
7
- data.tar.gz: 269c4b3ae7318f44b532beaab189352c00e57ebd942b6960ef6c5122f5c1cec0ea828706c0139a39498c3a15358b9764ae45169f1e56c5b4ab1ddbdf41bcae2a
6
+ metadata.gz: '01392024fcce36fb9788c654f66611d0d88ba635616d794c00f3a644231d64f965a70c54f5f005dc690540784a49f3e64289599781c8042de40ca88ec45a9b8d'
7
+ data.tar.gz: 295acc954c463bffa89b83db3781aeff4b8d59bba93ce1c645b99f5ae8930dd9bd600c9f624abb3a55e676a282014b30b3680d422aee17179cd41bc89d0ccb83
data/CHANGELOG.md CHANGED
@@ -15,6 +15,27 @@ 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.11.0-keycardai-oauth (2026-11-25)
19
+
20
+
21
+ - feat(keycardai-oauth): add a read-only WorkloadIdentity#client_id (SDK-146) (#79)
22
+ - Co-authored-by: devin-ai-keycard <devin-ai@keycard.ai>
23
+ Co-authored-by: Larry Osakwe <larry@keycard.ai>
24
+
25
+ ## 0.10.0-keycardai-oauth (2026-11-25)
26
+
27
+
28
+ - fix(keycardai-oauth)!: reject request client IDs with Basic token exchange (#78)
29
+ - * fix(keycardai-oauth)!: reject request client IDs with Basic token exchange
30
+ - Co-Authored-By: Larry Osakwe <larry@keycard.ai>
31
+ - * test(keycardai-oauth): cover request assertion precedence with workload identity
32
+ - Co-Authored-By: Larry Osakwe <larry@keycard.ai>
33
+ - * fix(keycardai-oauth): keep the Basic client_id guard on the prepared exchange path
34
+ - ---------
35
+ - Co-authored-by: devin-ai-keycard <devin-ai@keycard.ai>
36
+ Co-authored-by: Larry Osakwe <larry@keycard.ai>
37
+ Co-authored-by: Larry Osakwe <23560354+Larry-Osakwe@users.noreply.github.com>
38
+
18
39
  ## 0.9.2-keycardai-oauth (2026-11-25)
19
40
 
20
41
 
@@ -56,6 +56,7 @@ module Keycardai
56
56
  # token endpoint and, for a multi-zone credential, that zone's client
57
57
  # authentication. Defaults to the client's issuer.
58
58
  # @return [TokenResponse]
59
+ # @raise [ConfigurationError] when the request sets client_id with HTTP Basic
59
60
  # @raise [OAuthError] an RFC 6749 §5.2 error response (invalid_grant,
60
61
  # invalid_target, invalid_scope, unauthorized_client, ...)
61
62
  # @raise [HTTPError, ProtocolError, NetworkError]
@@ -112,14 +113,27 @@ module Keycardai
112
113
  raise ArgumentError, "client_assertion_type is required when client_assertion is set" if assertion && !type
113
114
  end
114
115
 
116
+ # An explicit client_assertion authenticates the client on its own, so
117
+ # the credential adds no Basic header and prepares no assertion.
115
118
  def post_exchange(subject_token, overrides, issuer)
116
119
  params = { "grant_type" => GrantType::TOKEN_EXCHANGE, "subject_token" => subject_token,
117
120
  "subject_token_type" => TokenType::ACCESS_TOKEN }.merge(overrides)
121
+ return post_token_request(params, issuer: issuer, authorization: nil) if overrides["client_assertion"]
122
+
118
123
  authorization = @credential&.authorization_header(issuer: issuer)
119
- params = with_assertion(params, issuer) if @credential && !authorization && !overrides["client_assertion"]
124
+ reject_client_id_with_basic(overrides, authorization)
125
+ params = with_assertion(params, issuer) if @credential && !authorization
120
126
  post_token_request(params, issuer: issuer, authorization: authorization)
121
127
  end
122
128
 
129
+ # A request client_id never travels beside HTTP Basic: fail before any
130
+ # HTTP request, including discovery.
131
+ def reject_client_id_with_basic(overrides, authorization)
132
+ return unless overrides.key?("client_id") && authorization&.match?(/\ABasic\s/i)
133
+
134
+ raise ConfigurationError, "token exchange client_id cannot be sent with HTTP Basic"
135
+ end
136
+
123
137
  def with_assertion(params, issuer)
124
138
  prepared = @credential.prepare_token_exchange_request(
125
139
  subject_token: params.fetch("subject_token"), resource: params["resource"],
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Keycardai
4
4
  module OAuth
5
- VERSION = "0.9.2"
5
+ VERSION = "0.11.0"
6
6
  end
7
7
  end
@@ -11,6 +11,8 @@ module Keycardai
11
11
  #
12
12
  # Holds no shared secret and contributes no Basic header.
13
13
  class WorkloadIdentity
14
+ attr_reader :client_id
15
+
14
16
  # @param source [#identity_token, #call] supplies the platform-signed
15
17
  # OIDC token; a bare callable is accepted
16
18
  # @param client_id [String, nil] public ID of the Keycard application
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.9.2
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keycard