openstack_keystone_core/k8s_auth/
error.rs1use thiserror::Error;
17
18use crate::error::BuilderError;
19
20#[derive(Error, Debug)]
22pub enum K8sAuthProviderError {
23 #[error("role `bound_audience` does not match")]
25 AudienceMismatch,
26
27 #[error("k8s instance {0} not active")]
29 AuthInstanceNotActive(String),
30
31 #[error("k8s instance {0} not found")]
33 AuthInstanceNotFound(String),
34
35 #[error("CA certificate of the k8s cannot be identified")]
37 CaCertificateUnknown,
38
39 #[error("conflict: {0}")]
41 Conflict(String),
42
43 #[error("backend driver error: {source}")]
45 Driver {
46 #[source]
48 source: Box<dyn std::error::Error + Send + Sync>,
49 },
50
51 #[error("invalid service account name of the token")]
54 FailedBoundServiceAccountName(String),
55
56 #[error("invalid service account namespace of the token")]
59 FailedBoundServiceAccountNamespace(String),
60
61 #[error("jwt validation error: {source}")]
63 Jwt {
64 #[from]
66 source: jsonwebtoken::errors::Error,
67 },
68
69 #[error("expired token")]
71 ExpiredToken,
72
73 #[error(transparent)]
75 Http {
76 #[from]
78 source: reqwest::Error,
79 },
80
81 #[error(transparent)]
83 IdentityProvider {
84 #[from]
86 source: crate::identity::error::IdentityProviderError,
87 },
88
89 #[error("insecure jwt signature algorithm")]
91 InsecureAlgorithm,
92
93 #[error("invalid token")]
95 InvalidToken,
96
97 #[error("invalid token review response")]
99 InvalidTokenReviewResponse,
100
101 #[error("k8s auth role {0} not found")]
103 RoleNotFound(String),
104
105 #[error("k8s auth role {0} not active")]
107 RoleNotActive(String),
108
109 #[error("k8s auth role {0} belongs to the other instance")]
111 RoleInstanceOwnershipMismatch(String),
112
113 #[error(transparent)]
115 StructBuilder {
116 #[from]
118 source: BuilderError,
119 },
120
121 #[error(transparent)]
123 TokenProvider {
124 #[from]
126 source: crate::token::TokenProviderError,
127 },
128
129 #[error("token restriction {0} not found")]
131 TokenRestrictionNotFound(String),
132
133 #[error("token restriction must specify `project_id`")]
135 TokenRestrictionMustSpecifyProjectId,
136
137 #[error("token restriction must specify `user_id`")]
139 TokenRestrictionMustSpecifyUserId,
140
141 #[error("unsupported driver `{0}` for the k8s provider")]
143 UnsupportedDriver(String),
144
145 #[error("user {0} not found")]
147 UserNotFound(String),
148}