Skip to content

Commit e17193f

Browse files
authored
fix: Fix conflicts (#499)
1 parent ce8a455 commit e17193f

File tree

4 files changed

+31
-20
lines changed

4 files changed

+31
-20
lines changed

src/api/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl From<CatalogProviderError> for KeystoneApiError {
218218
impl From<IdentityProviderError> for KeystoneApiError {
219219
fn from(value: IdentityProviderError) -> Self {
220220
match value {
221-
IdentityProviderError::AuthenticationInfo { source } => source.into(),
221+
IdentityProviderError::Authentication { source } => source.into(),
222222
IdentityProviderError::UserNotFound(x) => Self::NotFound {
223223
resource: "user".into(),
224224
identifier: x,
@@ -257,7 +257,7 @@ impl From<RevokeProviderError> for KeystoneApiError {
257257
impl From<TokenProviderError> for KeystoneApiError {
258258
fn from(value: TokenProviderError) -> Self {
259259
match value {
260-
TokenProviderError::AuthenticationInfo(source) => source.into(),
260+
TokenProviderError::Authentication(source) => source.into(),
261261
TokenProviderError::DomainDisabled(x) => Self::NotFound {
262262
resource: "domain".into(),
263263
identifier: x,

src/error.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,39 +41,39 @@ pub enum KeystoneError {
4141

4242
/// Assignment provider.
4343
#[error(transparent)]
44-
AssignmentError {
44+
AssignmentProvider {
4545
/// The source of the error.
4646
#[from]
4747
source: AssignmentProviderError,
4848
},
4949

5050
/// Catalog provider.
5151
#[error(transparent)]
52-
CatalogError {
52+
CatalogProvider {
5353
/// The source of the error.
5454
#[from]
5555
source: CatalogProviderError,
5656
},
5757

5858
/// Federation provider.
5959
#[error(transparent)]
60-
FederationError {
60+
FederationProvider {
6161
/// The source of the error.
6262
#[from]
6363
source: FederationProviderError,
6464
},
6565

6666
/// Identity provider.
6767
#[error(transparent)]
68-
IdentityError {
68+
IdentityProvider {
6969
/// The source of the error.
7070
#[from]
7171
source: IdentityProviderError,
7272
},
7373

7474
/// Identity mapping provider.
7575
#[error(transparent)]
76-
IdentityMappingError {
76+
IdentityMapping {
7777
/// The source of the error.
7878
#[from]
7979
source: IdentityMappingError,
@@ -89,7 +89,7 @@ pub enum KeystoneError {
8989

9090
/// Json serialization error.
9191
#[error("json serde error: {}", source)]
92-
JsonError {
92+
Json {
9393
/// The source of the error.
9494
#[from]
9595
source: serde_json::Error,
@@ -109,7 +109,7 @@ pub enum KeystoneError {
109109

110110
/// Resource provider.
111111
#[error(transparent)]
112-
ResourceError {
112+
ResourceProvider {
113113
/// The source of the error.
114114
#[from]
115115
source: ResourceProviderError,
@@ -167,12 +167,12 @@ pub enum BuilderError {
167167
UninitializedField(String),
168168
/// Custom validation error
169169
#[error("{0}")]
170-
ValidationError(String),
170+
Validation(String),
171171
}
172172

173173
impl From<String> for BuilderError {
174174
fn from(s: String) -> Self {
175-
Self::ValidationError(s)
175+
Self::Validation(s)
176176
}
177177
}
178178

src/identity/error.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::resource::error::ResourceProviderError;
2424
pub enum IdentityProviderError {
2525
/// Authentication error.
2626
#[error(transparent)]
27-
AuthenticationInfo {
27+
Authentication {
2828
#[from]
2929
source: crate::auth::AuthenticationError,
3030
},
@@ -109,12 +109,10 @@ impl From<IdentityDatabaseError> for IdentityProviderError {
109109
IdentityDatabaseError::Serde { source } => Self::Serde { source },
110110
IdentityDatabaseError::StructBuilder { source } => Self::StructBuilder { source },
111111
IdentityDatabaseError::PasswordHash { source } => Self::PasswordHash { source },
112-
IdentityDatabaseError::NoPasswordHash(..) => Self::AuthenticationInfo {
112+
IdentityDatabaseError::NoPasswordHash(..) => Self::Authentication {
113113
source: crate::auth::AuthenticationError::UserNameOrPasswordWrong,
114114
},
115-
IdentityDatabaseError::AuthenticationInfo { source } => {
116-
Self::AuthenticationInfo { source }
117-
}
115+
IdentityDatabaseError::AuthenticationInfo { source } => Self::Authentication { source },
118116
_ => Self::Backend { source },
119117
}
120118
}

src/token/error.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub enum TokenProviderError {
4646
#[error("application credential is bound to another project")]
4747
ApplicationCredentialScopeMismatch,
4848

49+
/// Assignment provider error.
4950
#[error(transparent)]
5051
AssignmentProvider {
5152
/// The source of the error.
@@ -57,9 +58,11 @@ pub enum TokenProviderError {
5758
#[error("audit_id must be urlsafe base64 encoded value")]
5859
AuditIdWrongFormat,
5960

61+
/// Authentication error.
6062
#[error(transparent)]
61-
AuthenticationInfo(#[from] crate::auth::AuthenticationError),
63+
Authentication(#[from] crate::auth::AuthenticationError),
6264

65+
/// Base64 Decode error.
6366
#[error("b64 decryption error")]
6467
Base64Decode(#[from] base64::DecodeError),
6568

@@ -79,10 +82,11 @@ pub enum TokenProviderError {
7982
#[error("token expired")]
8083
Expired,
8184

82-
/// Expired token
85+
/// Expiry calculation error
8386
#[error("token expiry calculation failed")]
8487
ExpiryCalculation,
8588

89+
/// Federated payload missing data error.
8690
#[error("federated payload must contain idp_id and protocol_id")]
8791
FederatedPayloadMissingData,
8892

@@ -103,6 +107,7 @@ pub enum TokenProviderError {
103107
path: std::path::PathBuf,
104108
},
105109

110+
/// Identity provider error.
106111
#[error(transparent)]
107112
IdentityProvider(#[from] crate::identity::error::IdentityProviderError),
108113

@@ -113,7 +118,7 @@ pub enum TokenProviderError {
113118
/// Unsupported token version
114119
#[error("token version {0} is not supported")]
115120
InvalidTokenType(u8),
116-
///
121+
117122
/// Unsupported token uuid
118123
#[error("token uuid is not supported")]
119124
InvalidTokenUuid,
@@ -147,9 +152,11 @@ pub enum TokenProviderError {
147152
#[error("project disabled")]
148153
ProjectDisabled(String),
149154

155+
/// Resource provider error.
150156
#[error(transparent)]
151157
ResourceProvider(#[from] crate::resource::error::ResourceProviderError),
152158

159+
/// Restricted token project scoped error.
153160
#[error("token with restrictions can be only project scoped")]
154161
RestrictedTokenNotProjectScoped,
155162

@@ -186,33 +193,39 @@ pub enum TokenProviderError {
186193
source: std::num::TryFromIntError,
187194
},
188195

196+
/// Token restriction not found error.
189197
#[error("token restriction {0} not found")]
190198
TokenRestrictionNotFound(String),
191199

192-
/// Revoked token
200+
/// Revoked token error.
193201
#[error("token has been revoked")]
194202
TokenRevoked,
195203

196204
/// Trust provider error.
197205
#[error(transparent)]
198206
TrustProvider(#[from] crate::trust::TrustError),
199207

208+
/// Integer conversion error.
200209
#[error("int parse")]
201210
TryFromIntError(#[from] TryFromIntError),
202211

212+
/// Unsupported authentication methods in token payload.
203213
#[error("unsupported authentication methods {0} in token payload")]
204214
UnsupportedAuthMethods(String),
205215

206216
/// The user is disabled.
207217
#[error("user disabled")]
208218
UserDisabled(String),
209219

220+
/// The user cannot be found error.
210221
#[error("user cannot be found: {0}")]
211222
UserNotFound(String),
212223

224+
/// UUID decryption error.
213225
#[error("uuid decryption error")]
214226
Uuid(#[from] uuid::Error),
215227

228+
/// Validation error.
216229
#[error("Token validation error: {0}")]
217230
Validation(#[from] validator::ValidationErrors),
218231
}

0 commit comments

Comments
 (0)