pub struct InstancePrincipalsAuthProvider { /* private fields */ }Expand description
Instance Principals Authentication Provider
Enables applications running on OCI compute instances to authenticate using X.509 certificates from the Instance Metadata Service (IMDS).
§Example
use oci_rust_sdk::auth::InstancePrincipalsAuthProvider;
use std::sync::Arc;
// Initialize provider (auto-detects region and fetches certs from IMDS)
let auth = InstancePrincipalsAuthProvider::new().await?;
let auth_ref = Arc::new(auth);
// Use with OciClient
// let client = OciClient::new(auth_ref, endpoint)?;Implementations§
Source§impl InstancePrincipalsAuthProvider
impl InstancePrincipalsAuthProvider
Sourcepub async fn new() -> Result<Self>
pub async fn new() -> Result<Self>
Create a new instance principals authentication provider
This will:
- Fetch region and certificates from IMDS
- Extract tenant ID from certificate
- Generate initial session keypair
- Request initial security token from federation service
§Errors
Returns an error if:
- IMDS is unavailable (not running on OCI instance)
- Certificate parsing fails
- Federation service is unreachable
- Token request fails
Trait Implementations§
Source§impl AuthProvider for InstancePrincipalsAuthProvider
impl AuthProvider for InstancePrincipalsAuthProvider
Source§fn get_key_id(&self) -> String
fn get_key_id(&self) -> String
Get the key ID (e.g., “ocid1.tenancy.oc1..xxxxx/ocid1.user.oc1..xxxxx/fingerprint”)
Source§fn get_private_key(&self) -> &str
fn get_private_key(&self) -> &str
Get the private key in PEM format
Source§fn get_passphrase(&self) -> Option<&str>
fn get_passphrase(&self) -> Option<&str>
Get the passphrase for the private key (if any)
Auto Trait Implementations§
impl Freeze for InstancePrincipalsAuthProvider
impl !RefUnwindSafe for InstancePrincipalsAuthProvider
impl Send for InstancePrincipalsAuthProvider
impl Sync for InstancePrincipalsAuthProvider
impl Unpin for InstancePrincipalsAuthProvider
impl UnsafeUnpin for InstancePrincipalsAuthProvider
impl !UnwindSafe for InstancePrincipalsAuthProvider
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more