TokenError

Enum TokenError 

Source
pub enum TokenError {
Show 24 variants InvalidSignature { details: String, }, UnknownPublicKey, InvalidKeyFormat { reason: String, }, DeserializationError { reason: String, }, SerializationError { reason: String, }, Base64DecodingError { reason: String, }, UnsupportedVersion { maximum: u32, minimum: u32, actual: u32, }, Expired { expired_at: i64, current_time: i64, block_id: u32, check_id: u32, }, DomainMismatch { expected: String, provided: Option<String>, block_id: u32, check_id: u32, }, CheckFailed { block_id: u32, check_id: u32, rule: String, }, IdentityMismatch { expected: String, actual: String, }, HierarchyViolation { expected: String, actual: String, delegatable: bool, block_id: u32, check_id: u32, }, AttenuationFailed { reason: String, }, BearerNotAllowed { reason: String, }, RightsDenied { subject: String, resource: String, operation: String, }, ServiceChainFailed { component: String, reason: ServiceChainFailure, }, MultiPartyAttestationMissing { component: String, expected_key: String, }, NoMatchingPolicy { failed_checks: Vec<CheckFailure>, }, PolicyMatchedButChecksFailed { policy_type: String, policy_index: usize, failed_checks: Vec<CheckFailure>, }, ExecutionLimitReached { reason: String, }, ExpressionError { reason: String, }, InvalidBlockRule { block_id: u32, rule: String, }, Internal(String), Generic(String),
}
Expand description

Detailed error type for hessra-token operations with specific failure information

Variants§

§

InvalidSignature

Token signature verification failed

Fields

§details: String
§

UnknownPublicKey

The root public key was not recognized

§

InvalidKeyFormat

Invalid key format provided

Fields

§reason: String
§

DeserializationError

Token deserialization failed

Fields

§reason: String
§

SerializationError

Token serialization failed

Fields

§reason: String
§

Base64DecodingError

Base64 decoding failed

Fields

§reason: String
§

UnsupportedVersion

Token format version is not supported

Fields

§maximum: u32
§minimum: u32
§actual: u32
§

Expired

Token has expired

Fields

§expired_at: i64

When the token expired (Unix timestamp)

§current_time: i64

Current time when verification was attempted (Unix timestamp)

§block_id: u32

Block ID where the expiration check failed

§check_id: u32

Check ID within the block

§

DomainMismatch

Domain restriction check failed

Fields

§expected: String

Expected domain from token

§provided: Option<String>

Domain provided during verification (if any)

§block_id: u32

Block ID where the check failed

§check_id: u32

Check ID within the block

§

CheckFailed

A generic check failed (couldn’t parse semantic meaning)

Fields

§block_id: u32

Block ID where the check failed

§check_id: u32

Check ID within the block

§rule: String

The Datalog rule that failed

§

IdentityMismatch

Identity/actor mismatch

Fields

§expected: String

Expected identity

§actual: String

Actual identity provided

§

HierarchyViolation

Identity hierarchy violation (delegation not allowed)

Fields

§expected: String

Base identity that issued the token

§actual: String

Actor attempting to use the token

§delegatable: bool

Whether delegation was allowed

§block_id: u32

Block ID where the check failed

§check_id: u32

Check ID within the block

§

AttenuationFailed

Token attenuation failed

Fields

§reason: String
§

BearerNotAllowed

Bearer token not allowed in this context

Fields

§reason: String
§

RightsDenied

Authorization rights denied

Fields

§subject: String

Subject requesting the action

§resource: String

Resource being accessed

§operation: String

Operation being performed

§

ServiceChainFailed

Service chain attestation failed

Fields

§component: String

Component name that failed

§reason: ServiceChainFailure

Specific reason for failure

§

MultiPartyAttestationMissing

Multi-party attestation missing

Fields

§component: String

Component requiring attestation

§expected_key: String

Expected public key

§

NoMatchingPolicy

No authorization policy matched and checks failed

Fields

§failed_checks: Vec<CheckFailure>

List of checks that failed

§

PolicyMatchedButChecksFailed

Authorization policy matched but checks failed

Fields

§policy_type: String

Type of policy that matched (Allow/Deny)

§policy_index: usize

Index of the policy

§failed_checks: Vec<CheckFailure>

List of checks that failed

§

ExecutionLimitReached

Datalog execution limit reached

Fields

§reason: String
§

ExpressionError

Datalog expression evaluation failed

Fields

§reason: String
§

InvalidBlockRule

Invalid block rule

Fields

§block_id: u32
§rule: String
§

Internal(String)

Internal error

§

Generic(String)

Generic error with message

Implementations§

Source§

impl TokenError

Source

pub fn is_expired(&self) -> bool

Check if this error is due to token expiration

Source

pub fn is_domain_mismatch(&self) -> bool

Check if this error is due to domain mismatch

Source

pub fn is_identity_mismatch(&self) -> bool

Check if this error is due to identity mismatch

Source

pub fn is_rights_denied(&self) -> bool

Check if this error is due to authorization rights denial

Source

pub fn is_service_chain_failure(&self) -> bool

Check if this error is due to service chain failure

Source

pub fn is_signature_error(&self) -> bool

Check if this error is a signature/format error

Source

pub fn get_expiration_time(&self) -> Option<i64>

Get the expiration time if this is an expiration error

Source

pub fn get_expected_domain(&self) -> Option<&str>

Get the expected domain if this is a domain mismatch error

Source

pub fn get_denied_access(&self) -> Option<(&str, &str, &str)>

Get the missing rights if this is a rights denied error

Source

pub fn generic<S>(msg: S) -> TokenError
where S: Into<String>,

Create a generic error

Source

pub fn internal<S>(msg: S) -> TokenError
where S: Into<String>,

Create an internal error

Source

pub fn invalid_key_format<S>(reason: S) -> TokenError
where S: Into<String>,

Create an invalid key format error

Trait Implementations§

Source§

impl Clone for TokenError

Source§

fn clone(&self) -> TokenError

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TokenError

Source§

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

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

impl Display for TokenError

Source§

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

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

impl Error for TokenError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<&str> for TokenError

Source§

fn from(err: &str) -> TokenError

Converts to this type from the input type.
Source§

impl From<FromHexError> for TokenError

Source§

fn from(err: FromHexError) -> TokenError

Converts to this type from the input type.
Source§

impl From<String> for TokenError

Source§

fn from(err: String) -> TokenError

Converts to this type from the input type.
Source§

impl From<Token> for TokenError

Source§

fn from(err: Token) -> TokenError

Converts to this type from the input type.

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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