Skip to content

Commit cb232b8

Browse files
authored
Merge pull request #174 from dezeroku/sso-auth
Add support for SSO login
2 parents ce852fd + 20f6974 commit cb232b8

File tree

8 files changed

+432
-31
lines changed

8 files changed

+432
-31
lines changed

Cargo.lock

+129-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ tokio-tungstenite = { version = "0.21", features = ["rustls-tls-native-roots"] }
6666
is-terminal = "0.4.12"
6767
regex = "1.10.4"
6868
rustix = { version = "0.38.33", features = ["termios", "procfs", "process", "pipe"] }
69+
open = "5.1.2"
70+
urlencoding = "2.1.3"
71+
axum = "0.7.5"
6972

7073
[package.metadata.deb]
7174
depends = "pinentry"

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,14 @@ configuration options:
6666

6767
* `email`: The email address to use as the account name when logging into the
6868
Bitwarden server. Required.
69+
* `sso_id`: The SSO organization ID. Defaults to regular login process if unset.
6970
* `base_url`: The URL of the Bitwarden server to use. Defaults to the official
7071
server at `https://api.bitwarden.com/` if unset.
7172
* `identity_url`: The URL of the Bitwarden identity server to use. If unset,
7273
will use the `/identity` path on the configured `base_url`, or
7374
`https://identity.bitwarden.com/` if no `base_url` is set.
75+
* `ui_url`: The URL of the Bitwarden UI to use. If unset,
76+
will default to `https://vault.bitwarden.com/`.
7477
* `notifications_url`: The URL of the Bitwarden notifications server to use.
7578
If unset, will use the `/notifications` path on the configured `base_url`,
7679
or `https://notifications.bitwarden.com/` if no `base_url` is set.

src/actions.rs

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub async fn login(
4242
let (access_token, refresh_token, protected_key) = client
4343
.login(
4444
email,
45+
config.sso_id.as_deref(),
4546
&crate::config::device_id(&config).await?,
4647
&identity.master_password_hash,
4748
two_factor_token,
@@ -336,6 +337,7 @@ fn api_client() -> Result<(crate::api::Client, crate::config::Config)> {
336337
let client = crate::api::Client::new(
337338
&config.base_url(),
338339
&config.identity_url(),
340+
&config.ui_url(),
339341
config.client_cert_path(),
340342
);
341343
Ok((client, config))
@@ -347,6 +349,7 @@ async fn api_client_async(
347349
let client = crate::api::Client::new(
348350
&config.base_url(),
349351
&config.identity_url(),
352+
&config.ui_url(),
350353
config.client_cert_path(),
351354
);
352355
Ok((client, config))

0 commit comments

Comments
 (0)