Class: OCI::Auth::Signers::SecurityTokenSigner

Inherits:
BaseSigner
  • Object
show all
Defined in:
lib/oci/auth/signers/security_token_signer.rb

Overview

The base signer for signing requests where the API key is a token (e.g. instance principals, service-to-service auth) rather representing the details for a specific user.

Constant Summary

Constants inherited from BaseSigner

BaseSigner::BODY_HEADERS, BaseSigner::GENERIC_HEADERS, BaseSigner::SIGNATURE_VERSION, BaseSigner::SIGNING_STRATEGY_ENUM

Instance Method Summary collapse

Methods inherited from BaseSigner

#sign

Constructor Details

#initialize(security_token, private_key, pass_phrase: nil, signing_strategy: OCI::BaseSigner::STANDARD, headers_to_sign_in_all_requests: OCI::BaseSigner::GENERIC_HEADERS, body_headers_to_sign: OCI::BaseSigner::BODY_HEADERS) ⇒ SecurityTokenSigner

Creates a new SecurityTokenSigner

Parameters:

  • security_token (Strong)

    The token to use as the API key

  • private_key (OpenSSL::PKey::RSA)

    The private key whose corresponding public key was provided when requesting the token

  • pass_phrase (String) (defaults to: nil)

    The pass phrase for the public key, if any. Defaults to nil (no passphrase) if not provided

  • signing_strategy (String) (defaults to: OCI::BaseSigner::STANDARD)

    Whether this signer is used for Object Storage requests or not. Acceptable values are BaseSigner::STANDARD and BaseSigner::OBJECT_STORAGE. If not provided, defaults to BaseSigner::STANDARD

  • headers_to_sign_in_all_requests (Array<String>) (defaults to: OCI::BaseSigner::GENERIC_HEADERS)

    An array of headers which will be signed in each request. If not provided, defaults to BaseSigner::GENERIC_HEADERS

  • body_headers_to_sign (Array<String>) (defaults to: OCI::BaseSigner::BODY_HEADERS)

    An array of headers which should be signed on requests with bodies. If not provided, defaults to BaseSigner::BODY_HEADERS



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/oci/auth/signers/security_token_signer.rb', line 20

def initialize(
  security_token,
  private_key,
  pass_phrase: nil,
  signing_strategy: OCI::BaseSigner::STANDARD,
  headers_to_sign_in_all_requests: OCI::BaseSigner::GENERIC_HEADERS,
  body_headers_to_sign: OCI::BaseSigner::BODY_HEADERS
)
  super(
    "ST$#{security_token}",
    private_key,
    pass_phrase: pass_phrase,
    signing_strategy: signing_strategy,
    headers_to_sign_in_all_requests: ,
    body_headers_to_sign: body_headers_to_sign
  )
end