stripe-workload-identity 0.1.0.pre.alpha.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 +7 -0
- data/lib/stripe/workload_identity/version.rb +7 -0
- data/lib/stripe/workload_identity.rb +44 -0
- data/rbi/stripe/workload_identity.rbi +20 -0
- metadata +68 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e861b3191d91a27674bb89a68eef14ac6f238af2955425f7233238eba273863c
|
|
4
|
+
data.tar.gz: df4d3bcf853b77ae86211e5da138d5a90e3e51c7d4b6e79505b6d0426d6c4d43
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ff16051d75e82024d90e39ef56144035d539516867d36e573ea4d7fe0b98ee078d277e91c778b590841a5ed8488bb4eb0bc8b1f196309a88139e45eefb1aa684
|
|
7
|
+
data.tar.gz: cf1f77b9948928da907663af187010e966fec25c51dff598a89e6017222595d4aa822c50162e5f4981b3f3fe3150c8d5c7238509c6abdc01ca0b978b790ac663
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "googleauth"
|
|
4
|
+
|
|
5
|
+
require "stripe/workload_identity/version"
|
|
6
|
+
|
|
7
|
+
module Stripe
|
|
8
|
+
module WorkloadIdentity
|
|
9
|
+
# The fixed audience that Stripe expects for workload identity
|
|
10
|
+
AUDIENCE = "https://access.stripe.com/wif"
|
|
11
|
+
|
|
12
|
+
# Error is raised when a Google-signed identity assertion can't be
|
|
13
|
+
# obtained. The original exception, if any, is available via `#cause`.
|
|
14
|
+
class Error < StandardError
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Implements the workload identity provider, matching the
|
|
18
|
+
# type expected by `Stripe::StripeClient.for_workload_identity`
|
|
19
|
+
class GcpWorkloadIdentity
|
|
20
|
+
def provider
|
|
21
|
+
"gcp"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def identity_assertion
|
|
25
|
+
credentials = Google::Auth::GCECredentials.new(token_type: :id_token, target_audience: AUDIENCE)
|
|
26
|
+
|
|
27
|
+
begin
|
|
28
|
+
credentials.fetch_access_token!
|
|
29
|
+
rescue StandardError => e
|
|
30
|
+
raise Error, "Unable to obtain a GCP workload identity assertion: #{e.message}. Check that this " \
|
|
31
|
+
"process is running in a GCP environment that exposes the metadata identity-token " \
|
|
32
|
+
"endpoint, that its workload identity is allowed to request an identity token, and " \
|
|
33
|
+
"that it can reach the metadata server. For local development, tests, and CI, use " \
|
|
34
|
+
"a Stripe API key with Stripe::StripeClient.new(...) instead."
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
token = credentials.id_token
|
|
38
|
+
raise Error, "The GCP metadata server returned no identity token." if token.nil? || token.empty?
|
|
39
|
+
|
|
40
|
+
token
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Stripe
|
|
4
|
+
module WorkloadIdentity
|
|
5
|
+
VERSION = T.let(T.unsafe(nil), String)
|
|
6
|
+
AUDIENCE = T.let(T.unsafe(nil), String)
|
|
7
|
+
|
|
8
|
+
class Error < StandardError; end
|
|
9
|
+
|
|
10
|
+
class GcpWorkloadIdentity
|
|
11
|
+
include ::Stripe::WorkloadIdentity::Provider
|
|
12
|
+
|
|
13
|
+
sig { override.returns(String) }
|
|
14
|
+
def provider; end
|
|
15
|
+
|
|
16
|
+
sig { override.returns(String) }
|
|
17
|
+
def identity_assertion; end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: stripe-workload-identity
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0.pre.alpha.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Stripe
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-10-21 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: googleauth
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.8'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.8'
|
|
27
|
+
description: Lets Stripe::StripeClient.for_workload_identity authenticate on Google
|
|
28
|
+
Cloud environments with a compatible metadata identity-token endpoint, using a Google-signed
|
|
29
|
+
identity token instead of a long-lived API key. Does not depend on the `stripe`
|
|
30
|
+
gem.
|
|
31
|
+
email: support@stripe.com
|
|
32
|
+
executables: []
|
|
33
|
+
extensions: []
|
|
34
|
+
extra_rdoc_files: []
|
|
35
|
+
files:
|
|
36
|
+
- lib/stripe/workload_identity.rb
|
|
37
|
+
- lib/stripe/workload_identity/version.rb
|
|
38
|
+
- rbi/stripe/workload_identity.rbi
|
|
39
|
+
homepage: https://stripe.com/docs/api?lang=ruby
|
|
40
|
+
licenses:
|
|
41
|
+
- MIT
|
|
42
|
+
metadata:
|
|
43
|
+
bug_tracker_uri: https://github.com/stripe/stripe-ruby/issues
|
|
44
|
+
documentation_uri: https://stripe.com/docs/api?lang=ruby
|
|
45
|
+
github_repo: ssh://github.com/stripe/stripe-ruby
|
|
46
|
+
homepage_uri: https://stripe.com/docs/api?lang=ruby
|
|
47
|
+
source_code_uri: https://github.com/stripe/stripe-ruby
|
|
48
|
+
rubygems_mfa_required: 'false'
|
|
49
|
+
post_install_message:
|
|
50
|
+
rdoc_options: []
|
|
51
|
+
require_paths:
|
|
52
|
+
- lib
|
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: 3.0.0
|
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0'
|
|
63
|
+
requirements: []
|
|
64
|
+
rubygems_version: 3.5.22
|
|
65
|
+
signing_key:
|
|
66
|
+
specification_version: 4
|
|
67
|
+
summary: GCP workload identity provider for the Stripe Ruby bindings
|
|
68
|
+
test_files: []
|