Module: OCI::Auth::Signers

Defined in:
lib/oci/auth/signers/resource_principals_signer.rb,
lib/oci/auth/signers/security_token_signer.rb,
lib/oci/auth/signers/resource_principals_federation_signer.rb,
lib/oci/auth/signers/instance_principals_security_token_signer.rb,
lib/oci/auth/signers/x509_federation_client_based_security_token_signer.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/rpt_path_provider.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/env_rpt_path_provider.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/imds_rpt_path_provider.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/string_rpt_path_provider.rb,
lib/oci/auth/signers/resource_principal_token_path_provider/default_rpt_path_provider.rb

Overview

signer

Defined Under Namespace

Modules: RptPathProvider Classes: InstancePrincipalsSecurityTokenSigner, ResourcePrincipalsFederationSigner, SecurityTokenSigner, X509FederationClientBasedSecurityTokenSigner

Constant Summary collapse

OCI_RESOURCE_PRINCIPAL_VERSION =
'OCI_RESOURCE_PRINCIPAL_VERSION'.freeze
OCI_RESOURCE_PRINCIPAL_RPT_ENDPOINT =
'OCI_RESOURCE_PRINCIPAL_RPT_ENDPOINT'.freeze
OCI_RESOURCE_PRINCIPAL_RPST_ENDPOINT =
'OCI_RESOURCE_PRINCIPAL_RPST_ENDPOINT'.freeze

Class Method Summary collapse

Class Method Details

.resource_principals_signer(resource_principal_token_path_provider: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/oci/auth/signers/resource_principals_signer.rb', line 14

def self.resource_principals_signer(resource_principal_token_path_provider: nil)
  rp_version = ENV[OCI_RESOURCE_PRINCIPAL_VERSION]

  if rp_version == '1.1'
    #
    # This signer takes the following parameters
    # - OCI_RESOURCE_PRINCIPAL_RPT_ENDPOINT
    #     The endpoint for retrieving the Resource Principal Token
    # - OCI_RESOURCE_PRINCIPAL_RPST_ENDPOINT
    #     The endpoint for retrieving the Resource Principal Session Token
    # - Resource Principal Token Path Provider
    #     An Object which Provides the complete path for getting the Resource Principal Token
    resource_principal_token_endpoint = ENV[OCI_RESOURCE_PRINCIPAL_RPT_ENDPOINT]
    resource_principal_session_token_endpoint = ENV[OCI_RESOURCE_PRINCIPAL_RPST_ENDPOINT]
    OCI::Auth::Signers::ResourcePrincipalsFederationSigner.new(
      rp_token_endpoint: resource_principal_token_endpoint,
      rp_session_endpoint: resource_principal_session_token_endpoint,
      rp_token_path_provider: resource_principal_token_path_provider
    )
  elsif rp_version.nil?
    raise Exception("#{OCI_RESOURCE_PRINCIPAL_VERSION} is not defined")
  else
    raise Exception("Unsupported #{OCI_RESOURCE_PRINCIPAL_VERSION}: #{rp_version}")
  end
end