Class: AzIdentity::Identity::WorkloadIdentityClient
- Inherits:
-
BaseClient
- Object
- BaseClient
- AzIdentity::Identity::WorkloadIdentityClient
- Defined in:
- lib/az_identity/identity/workload_identity_client.rb
Constant Summary
Constants inherited from BaseClient
Instance Attribute Summary collapse
-
#authority ⇒ Object
Returns the value of attribute authority.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#tenant_id ⇒ Object
Returns the value of attribute tenant_id.
-
#token_file ⇒ Object
Returns the value of attribute token_file.
Attributes inherited from BaseClient
Instance Method Summary collapse
- #fetch_credentials ⇒ Object
-
#initialize(options = {}) ⇒ WorkloadIdentityClient
constructor
A new instance of WorkloadIdentityClient.
Methods inherited from BaseClient
#fetch_credentials_if_needed, #refresh_needed?
Methods included from AzureEnvironment
#authority_url, #redis_resource, #storage_resource
Constructor Details
#initialize(options = {}) ⇒ WorkloadIdentityClient
Returns a new instance of WorkloadIdentityClient.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/az_identity/identity/workload_identity_client.rb', line 12 def initialize( = {}) super() @environment = [:environment] @resource = [:resource] || storage_resource(@environment) @authority = ENV['AZURE_AUTHORITY_HOST'] || (@environment) @tenant_id = ENV.fetch('AZURE_TENANT_ID', nil) @client_id = ENV.fetch('AZURE_CLIENT_ID', nil) @token_file = ENV.fetch('AZURE_FEDERATED_TOKEN_FILE', nil) end |
Instance Attribute Details
#authority ⇒ Object
Returns the value of attribute authority.
10 11 12 |
# File 'lib/az_identity/identity/workload_identity_client.rb', line 10 def @authority end |
#client_id ⇒ Object
Returns the value of attribute client_id.
10 11 12 |
# File 'lib/az_identity/identity/workload_identity_client.rb', line 10 def client_id @client_id end |
#environment ⇒ Object
Returns the value of attribute environment.
10 11 12 |
# File 'lib/az_identity/identity/workload_identity_client.rb', line 10 def environment @environment end |
#resource ⇒ Object
Returns the value of attribute resource.
10 11 12 |
# File 'lib/az_identity/identity/workload_identity_client.rb', line 10 def resource @resource end |
#tenant_id ⇒ Object
Returns the value of attribute tenant_id.
10 11 12 |
# File 'lib/az_identity/identity/workload_identity_client.rb', line 10 def tenant_id @tenant_id end |
#token_file ⇒ Object
Returns the value of attribute token_file.
10 11 12 |
# File 'lib/az_identity/identity/workload_identity_client.rb', line 10 def token_file @token_file end |
Instance Method Details
#fetch_credentials ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/az_identity/identity/workload_identity_client.rb', line 24 def fetch_credentials return unless federated_credentials_available? response = post(token_endpoint, body: token_request_body) process_token_response(response) rescue ::Faraday::Error => e raise FetchCredentialsError, e.to_s end |