bitwarden_core/client/
login_method.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#[cfg(feature = "secrets")]
use std::path::PathBuf;

use bitwarden_crypto::Kdf;
#[cfg(feature = "secrets")]
use uuid::Uuid;

#[cfg(feature = "secrets")]
use crate::auth::AccessToken;

#[derive(Debug)]
pub(crate) enum LoginMethod {
    #[allow(dead_code)]
    User(UserLoginMethod),
    // TODO: Organizations supports api key
    // Organization(OrganizationLoginMethod),
    #[cfg(feature = "secrets")]
    ServiceAccount(ServiceAccountLoginMethod),
}

#[allow(dead_code)]
#[derive(Debug)]
pub(crate) enum UserLoginMethod {
    Username {
        client_id: String,
        email: String,
        kdf: Kdf,
    },
    ApiKey {
        client_id: String,
        client_secret: String,

        email: String,
        kdf: Kdf,
    },
}

#[cfg(feature = "secrets")]
#[derive(Debug)]
pub(crate) enum ServiceAccountLoginMethod {
    AccessToken {
        access_token: AccessToken,
        organization_id: Uuid,
        state_file: Option<PathBuf>,
    },
}