Skip to main content

PlatformIdentity

Enum PlatformIdentity 

Source
#[non_exhaustive]
pub enum PlatformIdentity { KubernetesServiceAccount { namespace: String, service_account: String, pod: Option<String>, }, Spiffe { trust_domain: String, name: String, version: String, }, Shared { name: String, }, OutboundMarker, Unknown, }
Expand description

Method-agnostic platform identity produced by validating an InternalCredential.

The variant reflects which credential authenticated the caller; platform handlers consume a PlatformSecurityContext without branching on it. New authentication methods add a variant — hence #[non_exhaustive] — without changing PlatformSecurityContext’s shape.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

KubernetesServiceAccount

First phase: a validated K8s ServiceAccount (from a projected SA token verified via the TokenReview API).

Fields

§namespace: String

Namespace the ServiceAccount belongs to.

§service_account: String

ServiceAccount name.

§pod: Option<String>

Originating pod name, when the token review reports it.

§

Spiffe

Next phase: an mTLS + SPIFFE workload identity parsed from the X.509 SAN (spiffe://<trust_domain>/gear/<name>/<version>). Reserved — not populated in the first phase.

Fields

§trust_domain: String

SPIFFE trust domain.

§name: String

Workload name component of the SPIFFE ID (the gear segment of spiffe://<trust_domain>/gear/<name>/<version>).

§version: String

Version component of the SPIFFE ID.

§

Shared

A caller authenticated by a pre-shared secret (dev / single-node profiles). Not tied to any deployment substrate: it exists so the platform plane can be exercised end-to-end without Kubernetes. The name is a configured label used for workload-policy decisions.

Fields

§name: String

Configured caller label (returned by PlatformIdentity::peer_name).

§

OutboundMarker

A credential-free outbound plane marker, not an authenticated caller.

Produced only by PlatformSecurityContext::outbound_marker, so gear code can satisfy a platform-plane signature without possessing a real identity. It is never the result of validating anything, and must never authorize anything.

It has its own variant because it used to share Self::Unknown, leaving one value meaning two unrelated things — a locally minted marker and a peer identity this build does not recognise — with peer_name() answering "<unknown>" for both.

§

Unknown

Catch-all for variants introduced in a newer library version.

Produced only by serde::Deserialize when the "type" field holds an unrecognised value; peer_name returns "<unknown>" for it.

It no longer doubles as the outbound marker — see Self::OutboundMarker.

Implementations§

Source§

impl PlatformIdentity

Source

pub fn peer_name(&self) -> &str

The caller’s name, distilled for workload-policy decisions.

For a PlatformIdentity::KubernetesServiceAccount this is the ServiceAccount name; for PlatformIdentity::Spiffe it is the workload (gear) component of the SPIFFE ID.

Trait Implementations§

Source§

impl Clone for PlatformIdentity

Source§

fn clone(&self) -> PlatformIdentity

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlatformIdentity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PlatformIdentity

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for PlatformIdentity

Source§

impl PartialEq for PlatformIdentity

Source§

fn eq(&self, other: &PlatformIdentity) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for PlatformIdentity

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PlatformIdentity

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more