Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
db62e00
RUST-1662: Initial caching checkpoint
pmeredit Mar 5, 2024
5738c04
RUST-1662: Finish non-speculative initial authentication
pmeredit Mar 5, 2024
e0ba578
RUST-1662: Refactor out two_step_auth
pmeredit Mar 5, 2024
3d73dd0
RUST-1662: Use constants, use u32 instead of i32 for things that cann…
pmeredit Mar 5, 2024
014ae5d
RUST-1662: Add speculative command building
pmeredit Mar 5, 2024
43f934a
RUST-1662: Update validation and and comments
pmeredit Mar 5, 2024
cf0ad9f
RUST-1662: Make oidc test patchable
pmeredit Mar 5, 2024
6cf4d20
RUST-1662: Add human test
pmeredit Mar 5, 2024
db511b2
RUST-1662: Update error
pmeredit Mar 5, 2024
cff6abc
Update src/client/auth/oidc.rs
pmeredit Mar 5, 2024
80f8b06
RUST-1662: Fix problems with spec auth
pmeredit Mar 5, 2024
b3cf7f5
RUST-1662: Minor cleanup
pmeredit Mar 5, 2024
fe22a70
RUST-1662: Why is validate failing in the tests?
pmeredit Mar 5, 2024
a58357e
RUST-1662: use multithreaded?
pmeredit Mar 6, 2024
376b2f3
RUST-1662: Ok, looks like we need to propagate async. The change was …
pmeredit Mar 6, 2024
b958989
RUST-1662: See if the validate failure was just caused by a misuse of…
pmeredit Mar 6, 2024
faee44e
RUST-1662: Add callback so validate doesn't fail
pmeredit Mar 6, 2024
df0fd63
RUST-1662: Do better, don't add empty callback, also don't require ca…
pmeredit Mar 6, 2024
900c9e6
Update src/client/auth/oidc.rs
pmeredit Mar 6, 2024
0c909bd
RUST-1662: Refactor and ensure that idpserver info and refresh token …
pmeredit Mar 6, 2024
a8c3588
RUST-1662: Change to use token_gen_id like the python driver
pmeredit Mar 6, 2024
f5c20e2
RUST-1662: Use consistent naming between the two cache functions
pmeredit Mar 6, 2024
6a527a0
RUST-1662: rustfmt?
pmeredit Mar 6, 2024
e80dc57
RUST-1662: Use std::sync::RwLock for Client Cache
pmeredit Mar 6, 2024
a7099b4
RUST-1662: Connection Cache can also be sync since it's not public
pmeredit Mar 6, 2024
ce319ad
RUST-1662: Looks like the rustfmt problem is with stable vs nightly
pmeredit Mar 6, 2024
b3e8be5
RUST-1662: Fix unnecessary async, reuse method
pmeredit Mar 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ buildvariants:

- name: oidc
display_name: OIDC
patchable: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be removed before merge, again :)

patchable: true
run_on:
- rhel87-small
- ubuntu2204-small
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just so the oidc tests would start immediately

expansions:
AUTH: auth
SSL: ssl
Expand Down
15 changes: 12 additions & 3 deletions src/client/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl AuthMechanism {
));
}
// TODO RUST-1660: Handle specific provider validation, perhaps also do Azure as
// part of this ticket.
// part of this ticket. Specific providers will add predefined oidc_callback here
if credential
.source
.as_ref()
Expand Down Expand Up @@ -279,7 +279,9 @@ impl AuthMechanism {
x509::build_speculative_client_first(credential),
)))),
Self::Plain => Ok(None),
Self::MongoDbOidc => Ok(None),
Self::MongoDbOidc => Ok(Some(ClientFirst::Oidc(Box::new(
oidc::build_speculative_client_first(credential),
)))),
#[cfg(feature = "aws-auth")]
AuthMechanism::MongoDbAws => Ok(None),
AuthMechanism::MongoDbCr => Err(ErrorKind::Authentication {
Expand Down Expand Up @@ -332,7 +334,7 @@ impl AuthMechanism {
}
.into()),
AuthMechanism::MongoDbOidc => {
oidc::authenticate_stream(stream, credential, server_api).await
oidc::authenticate_stream(stream, credential, server_api, None).await
}
_ => Err(ErrorKind::Authentication {
message: format!("Authentication mechanism {:?} not yet implemented.", self),
Expand Down Expand Up @@ -459,6 +461,9 @@ impl Credential {
FirstRound::X509(server_first) => {
x509::authenticate_stream(conn, self, server_api, server_first).await
}
FirstRound::Oidc(server_first) => {
oidc::authenticate_stream(conn, self, server_api, server_first).await
}
};
}

Expand Down Expand Up @@ -517,13 +522,15 @@ impl Debug for Credential {
pub(crate) enum ClientFirst {
Scram(ScramVersion, scram::ClientFirst),
X509(Box<Command>),
Oidc(Box<Command>),
}

impl ClientFirst {
pub(crate) fn to_document(&self) -> Document {
match self {
Self::Scram(version, client_first) => client_first.to_command(version).body,
Self::X509(command) => command.body.clone(),
Self::Oidc(command) => command.body.clone(),
}
}

Expand All @@ -537,6 +544,7 @@ impl ClientFirst {
},
),
Self::X509(..) => FirstRound::X509(server_first),
Self::Oidc(..) => FirstRound::Oidc(server_first),
}
}
}
Expand All @@ -547,6 +555,7 @@ impl ClientFirst {
pub(crate) enum FirstRound {
Scram(ScramVersion, scram::FirstRound),
X509(Document),
Oidc(Document),
}

pub(crate) fn generate_nonce_bytes() -> [u8; 32] {
Expand Down
Loading