bitwarden_core/auth/login/
mod.rs

1#[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
44    #[error(transparent)]
45    MissingField(#[from] crate::MissingFieldError),
46
47    #[error(transparent)]
48    JwtTokenParse(#[from] super::JwtTokenParseError),
49    #[error("JWT token is missing email")]
50    JwtTokenMissingEmail,
51
52    #[cfg(feature = "internal")]
53    #[error(transparent)]
54    Prelogin(#[from] PreloginError),
55    #[error(transparent)]
56    EncryptionSettings(#[from] crate::client::encryption_settings::EncryptionSettingsError),
57    #[error(transparent)]
58    AccessTokenInvalid(#[from] super::AccessTokenInvalidError),
59    #[error(transparent)]
60    NotAuthenticated(#[from] super::NotAuthenticatedError),
61    #[cfg(feature = "secrets")]
62    #[error(transparent)]
63    StateFile(#[from] crate::secrets_manager::state::StateFileError),
64    #[error("Error parsing Identity response: {0}")]
65    IdentityFail(crate::auth::api::response::IdentityTokenFailResponse),
66
67    #[error("The state file could not be read")]
68    InvalidStateFile,
69    #[error("Invalid organization id")]
70    InvalidOrganizationId,
71
72    #[error("The response received was invalid and could not be processed")]
73    InvalidResponse,
74
75    #[error("Auth request was not approved")]
76    AuthRequestNotApproved,
77
78    #[error("Failed to authenticate")]
79    AuthenticationFailed,
80}