bitwarden_core/auth/login/
mod.rs1#[allow(missing_docs)]
2pub mod response;
3
4#[cfg(feature = "internal")]
5mod prelogin;
6#[cfg(feature = "internal")]
7pub use prelogin::*;
8
9#[cfg(any(feature = "internal", feature = "secrets"))]
10mod password;
11#[cfg(any(feature = "internal", feature = "secrets"))]
12pub use password::*;
13
14#[cfg(feature = "internal")]
15mod two_factor;
16#[cfg(feature = "internal")]
17pub use two_factor::*;
18
19#[cfg(feature = "internal")]
20mod api_key;
21#[cfg(feature = "internal")]
22pub use api_key::*;
23
24#[cfg(feature = "internal")]
25mod auth_request;
26#[cfg(feature = "internal")]
27pub use auth_request::*;
28
29#[cfg(feature = "secrets")]
30mod access_token;
31#[cfg(feature = "secrets")]
32pub use access_token::*;
33
34#[allow(missing_docs)]
35#[derive(Debug, thiserror::Error)]
36pub enum LoginError {
37 #[error(transparent)]
38 Api(#[from] crate::ApiError),
39 #[error(transparent)]
40 Crypto(#[from] bitwarden_crypto::CryptoError),
41 #[error(transparent)]
42 Serde(#[from] serde_json::Error),
43 #[error(transparent)]
44 InvalidBase64(#[from] base64::DecodeError),
45
46 #[error(transparent)]
47 MissingField(#[from] crate::MissingFieldError),
48
49 #[error(transparent)]
50 JwtTokenParse(#[from] super::JwtTokenParseError),
51 #[error("JWT token is missing email")]
52 JwtTokenMissingEmail,
53
54 #[cfg(feature = "internal")]
55 #[error(transparent)]
56 Prelogin(#[from] PreloginError),
57 #[error(transparent)]
58 EncryptionSettings(#[from] crate::client::encryption_settings::EncryptionSettingsError),
59 #[error(transparent)]
60 AccessTokenInvalid(#[from] super::AccessTokenInvalidError),
61 #[error(transparent)]
62 NotAuthenticated(#[from] super::NotAuthenticatedError),
63 #[cfg(feature = "secrets")]
64 #[error(transparent)]
65 StateFile(#[from] crate::secrets_manager::state::StateFileError),
66 #[error("Error parsing Identity response: {0}")]
67 IdentityFail(crate::auth::api::response::IdentityTokenFailResponse),
68
69 #[error("The state file could not be read")]
70 InvalidStateFile,
71 #[error("Invalid organization id")]
72 InvalidOrganizationId,
73
74 #[error("The response received was invalid and could not be processed")]
75 InvalidResponse,
76
77 #[error("Auth request was not approved")]
78 AuthRequestNotApproved,
79
80 #[error("Failed to authenticate")]
81 AuthenticationFailed,
82}