Oracle Cloud
Oracle Cloud Infrastructure services authenticating with the OCI HTTP request signature.
Header signing only; expires_in is not interpreted as query authentication.
Get started
cargo add reqsign --features oracle
use reqsign::{default_context, oracle};
// Env and the OCI config file (~/.oci/config) — resolved by the default chain.
let ctx = default_context();
let signer = oracle::default_signer(ctx);
let mut req = http::Request::builder()
.method(http::Method::GET)
.uri("https://objectstorage.us-ashburn-1.oraclecloud.com/n/my-namespace/b/my-bucket/o/my-object")
.body(())?
.into_parts()
.0;
// Sign in place, then send with the HTTP client you already use.
signer.sign(&mut req, None).await?;
Request body headers
For POST, PUT, and PATCH requests, OCI requires content-length,
content-type, and x-content-sha256 in the signature. Set these headers on
the request before calling sign; reqsign signs the supplied values and does
not read the body. x-content-sha256 is the base64-encoded SHA-256 digest of
the body; for an empty body it is
47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=. Set the headers before signing;
headers added or replaced by the HTTP client afterwards are not covered by the
signature.
Object Storage PutObject and UploadPart PUT requests may omit the body
headers. If they are present, reqsign signs them. GET, HEAD, and DELETE
requests keep signing only date, (request-target), and host.
Credentials
Default credential chain
The default signer tries these sources in order and uses the first one that yields a credential — no configuration needed when any of them is present:
- Environment variables
- OCI config file (~/.oci/config)
Credential providers
Available ProvideCredential implementations. Construct any of them directly, reorder them, or compose them into your own chain — see Loading credentials:
EnvCredentialProvider— Environment variablesConfigFileCredentialProvider— OCI config file (~/.oci/config)StaticCredentialProvider— Static API key materialConfigCredentialProvider— Explicit config object