redis-cloud-auth 0.1.1 → 0.2.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: 38ea94b4c1ba73497e2f1a0a2361e89ade15ef08448918bd6b7ecf547e8eb58c
4
- data.tar.gz: 1b2f09a65797c4835c31d9a55dc6dfc35a13a48a425c71823c4658ffbe939fa3
3
+ metadata.gz: 9e0f6d959636e5e83fd769075e23d8d1987333cb9234085b52c42eb3521fcaf2
4
+ data.tar.gz: d949d9c9fde8b8e98b58c9f5a114aab9b0d20ee9cd5987622b788c60f814ac5c
5
5
  SHA512:
6
- metadata.gz: c26b1606fea6ac11fe371c0eaee96522ff8306ad87a7c6ddc04bc0be2a84c82e362320dddf87f410d82dc6f4679ee22458d410b83f3c0b7bd9a741d39551cb1c
7
- data.tar.gz: c1aa555ca7f01e362882bb99f3b74c097c1d3955892ea1bb921542239c7990f5572a92dd6afa042117ff44b59c2677a0397adca295cdb32cb9075b1ab7931de3
6
+ metadata.gz: d692119ac4b9ab88d078a253cd13c3b77d416d3b9e2e08bfce0b0b6e12ad5129837d62810d0f30aad3266d8ef4c02300e90c53c19cd21d1ac361d09765df5123
7
+ data.tar.gz: 7644e003e744bdc7612455dfae63bb7a8eb3ee965bb7c6a976fa7542872632e8fe7acf3b888d562327418add9c124a6bfedc68234ceee26a3c2058f368356e3d
data/README.md CHANGED
@@ -27,7 +27,7 @@ gem "redis-cloud-auth"
27
27
  Then add the backend gem for the provider(s) you use (they are loaded lazily and
28
28
  are not hard dependencies):
29
29
 
30
- - `:azure` → `az-identity`
30
+ - `:azure` → `az-identity` (0.2.0 or later)
31
31
  - `:aws` ElastiCache → `aws-sigv4`
32
32
  - `:gcp` → `googleauth`
33
33
 
@@ -87,7 +87,7 @@ provider.expires_at # => Time, or nil before the first token is fetched
87
87
 
88
88
  | `:provider` | Service | Backend gem | Key descriptor options |
89
89
  |---|---|---|---|
90
- | `:azure` | Azure Managed Redis / Entra | `az-identity` | `:username`, `:resource`, `:environment` |
90
+ | `:azure` | Azure Managed Redis / Entra | `az-identity` | `:username`, `:resource`, `:environment`, `:client_id` or `:object_id` |
91
91
  | `:elasticache` | AWS ElastiCache IAM | `aws-sigv4` | `:user_id`, `:cache_name`, `:region`, `:credentials` |
92
92
  | `:gcp` | GCP Memorystore IAM | `googleauth` | `:username`, `:scope`, `:credentials` |
93
93
 
@@ -95,6 +95,24 @@ Providers fetch tokens from the ambient workload identity by default (Azure
95
95
  Workload Identity, AWS IRSA/Pod Identity, GKE Workload Identity, or the instance
96
96
  metadata server), so no key material lives in the descriptor.
97
97
 
98
+ On a host with several Azure identities (for example one for object storage
99
+ and one for Redis), set `:client_id` or `:object_id` in the `:azure` descriptor
100
+ to pick the Redis one. Without it, az-identity uses the `AZURE_CLIENT_ID`
101
+ environment variable, which every library in the process shares.
102
+
103
+ - `:client_id` works with both managed identity and Azure Workload Identity.
104
+ Use it on AKS.
105
+ - `:object_id` works with managed identity only. With it set, az-identity skips
106
+ Workload Identity and asks the instance metadata service for that identity.
107
+
108
+ ```ruby
109
+ descriptor = {
110
+ provider: :azure,
111
+ resource: "https://redis.azure.com",
112
+ object_id: "<redis-identity-object-id>"
113
+ }
114
+ ```
115
+
98
116
  > All three providers are verified against a live managed Redis: Entra on Azure
99
117
  > Managed Redis, IAM on GCP Memorystore for Redis Cluster, and IAM on AWS
100
118
  > ElastiCache Serverless.
@@ -8,16 +8,27 @@ module RedisCloudAuth
8
8
  # principal object (principal) ID from the token's +oid+ claim.
9
9
  #
10
10
  # Descriptor keys: :username (optional), :resource (for example
11
- # "https://redis.azure.com"), :environment (optional Azure cloud).
11
+ # "https://redis.azure.com"), :environment (optional Azure cloud), and
12
+ # :client_id or :object_id (optional) to pick one of several identities
13
+ # on the host. Without them, az-identity falls back to the AZURE_CLIENT_ID
14
+ # environment variable, which the whole process shares (for example with
15
+ # object storage). :client_id works with managed identity and Workload
16
+ # Identity; :object_id works with managed identity only, so az-identity
17
+ # skips Workload Identity when it is set. Use :client_id on AKS.
12
18
  module Azure
19
+ IDENTITY_KEYS = %i[client_id object_id].freeze
20
+
13
21
  def self.build(descriptor)
14
- # Lazily required so az-identity is only pulled in when Azure is used.
22
+ # Lazily loaded so az-identity is only pulled in when Azure is used.
23
+ # 0.2.0 is the first release that honors :client_id / :object_id.
24
+ gem "az-identity", ">= 0.2.0"
15
25
  require "az_identity"
16
26
 
17
27
  AzIdentity::RedisCredentialsProvider.new(
18
28
  username: descriptor[:username],
19
29
  resource: descriptor[:resource],
20
- environment: descriptor[:environment]
30
+ environment: descriptor[:environment],
31
+ **descriptor.slice(*IDENTITY_KEYS).compact
21
32
  )
22
33
  end
23
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RedisCloudAuth
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-cloud-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-06 00:00:00.000000000 Z
11
+ date: 2026-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-client