pub enum TokenError {
Show 22 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,
},
NamespaceMismatch {
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: Option<String>,
resource: String,
operation: 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
UnknownPublicKey
The root public key was not recognized
InvalidKeyFormat
Invalid key format provided
DeserializationError
Token deserialization failed
SerializationError
Token serialization failed
Base64DecodingError
Base64 decoding failed
UnsupportedVersion
Token format version is not supported
Expired
Token has expired
Fields
NamespaceMismatch
Namespace restriction check failed
Fields
CheckFailed
A generic check failed (couldn’t parse semantic meaning)
Fields
IdentityMismatch
Identity/actor mismatch
HierarchyViolation
Identity hierarchy violation (delegation not allowed)
Fields
AttenuationFailed
Token attenuation failed
BearerNotAllowed
Bearer token not allowed in this context
RightsDenied
Capability rights denied
Fields
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
failed_checks: Vec<CheckFailure>List of checks that failed
ExecutionLimitReached
Datalog execution limit reached
ExpressionError
Datalog expression evaluation failed
InvalidBlockRule
Invalid block rule
Internal(String)
Internal error
Generic(String)
Generic error with message
Implementations§
Source§impl TokenError
impl TokenError
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this error is due to token expiration
Sourcepub fn is_namespace_mismatch(&self) -> bool
pub fn is_namespace_mismatch(&self) -> bool
Check if this error is due to namespace mismatch
Sourcepub fn is_identity_mismatch(&self) -> bool
pub fn is_identity_mismatch(&self) -> bool
Check if this error is due to identity mismatch
Sourcepub fn is_rights_denied(&self) -> bool
pub fn is_rights_denied(&self) -> bool
Check if this error is due to authorization rights denial
Sourcepub fn is_signature_error(&self) -> bool
pub fn is_signature_error(&self) -> bool
Check if this error is a signature/format error
Sourcepub fn get_expiration_time(&self) -> Option<i64>
pub fn get_expiration_time(&self) -> Option<i64>
Get the expiration time if this is an expiration error
Sourcepub fn get_expected_namespace(&self) -> Option<&str>
pub fn get_expected_namespace(&self) -> Option<&str>
Get the expected namespace if this is a namespace mismatch error
Sourcepub fn get_denied_access(&self) -> Option<(Option<&str>, &str, &str)>
pub fn get_denied_access(&self) -> Option<(Option<&str>, &str, &str)>
Get the missing rights if this is a rights denied error
Sourcepub fn generic<S>(msg: S) -> TokenError
pub fn generic<S>(msg: S) -> TokenError
Create a generic error
Sourcepub fn internal<S>(msg: S) -> TokenError
pub fn internal<S>(msg: S) -> TokenError
Create an internal error
Sourcepub fn invalid_key_format<S>(reason: S) -> TokenError
pub fn invalid_key_format<S>(reason: S) -> TokenError
Create an invalid key format error
Trait Implementations§
Source§impl Clone for TokenError
impl Clone for TokenError
Source§fn clone(&self) -> TokenError
fn clone(&self) -> TokenError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more