Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
92 changes: 81 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions crates/facet-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,23 @@ serde_json = { workspace = true }
rand = { workspace = true }
ed25519-dalek = { workspace = true }
pkcs8 = { workspace = true }
rstest = { workspace = true }
rsa = { workspace = true }
async-trait = {workspace = true}
http = {workspace = true}
pingora = {workspace = true}
pingora-core = {workspace = true}
pingora-proxy = {workspace = true}
pingora-http = "0.6"
aws-sigv4 = "1.2"
aws-credential-types = {workspace = true}
aws-smithy-runtime-api = {workspace = true}
regex = {workspace = true}
url = "2.5"
sqlx = {workspace = true}
tokio = {workspace = true}
reqwest = {workspace = true}
log = {workspace = true}

[dev-dependencies]
aws-sdk-s3 = { workspace = true }
aws-config = { workspace = true }
testcontainers = { workspace = true }
testcontainers-modules = { workspace = true, features = ["hashicorp_vault"] }
dsdk-facet-testcontainers = { path = "../facet-testcontainers" }
dsdk-facet-postgres = { path = "../facet-postgres" }
tokio = { workspace = true }
reqwest = { workspace = true }
wiremock = { workspace = true }
uuid = { workspace = true }
once_cell = { workspace = true }
mockall = { workspace = true }
rstest = { workspace = true }
2 changes: 0 additions & 2 deletions crates/facet-core/src/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@
mod tests;

mod mem;
mod postgres;

use crate::context::ParticipantContext;
use bon::Builder;
use regex::Regex;
use thiserror::Error;

pub use mem::MemoryAuthorizationEvaluator;
pub use postgres::PostgresAuthorizationEvaluator;

/// Represents an operation with specific attributes that describe its scope, action, and resource.
///
Expand Down
1 change: 0 additions & 1 deletion crates/facet-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ pub mod auth;
pub mod context;
pub mod jwt;
pub mod lock;
pub mod proxy;
pub mod token;
pub mod util;
pub mod vault;
Expand Down
6 changes: 2 additions & 4 deletions crates/facet-core/src/lock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ use std::sync::Arc;
use thiserror::Error;

pub mod mem;
pub mod postgres;
mod tests;

pub use mem::MemoryLockManager;
pub use postgres::PostgresLockManager;

/// Provide distributed locking for coordinating access to shared resources.
///
Expand Down Expand Up @@ -118,9 +116,9 @@ pub struct LockGuard {
}

impl LockGuard {
pub(crate) fn new<T>(lock_manager: Arc<T>, identifier: impl Into<String>, owner: impl Into<String>) -> Self
pub fn new<T>(lock_manager: Arc<T>, identifier: impl Into<String>, owner: impl Into<String>) -> Self
where
T: LockManagerInternal + 'static,
T: LockManager + UnlockOps + 'static,
{
Self {
lock_manager,
Expand Down
13 changes: 0 additions & 13 deletions crates/facet-core/src/proxy/mod.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/facet-core/src/token/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@

pub mod mem;
pub mod oauth;
pub mod postgres;

#[cfg(test)]
mod tests;

pub use mem::MemoryTokenStore;
pub use postgres::PostgresTokenStore;

const FIVE_SECONDS_MILLIS: i64 = 5_000;

Expand Down
2 changes: 0 additions & 2 deletions crates/facet-core/src/vault/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
// Metaform Systems, Inc. - initial API and implementation
//

pub mod hashicorp;

#[cfg(test)]
mod tests;

Expand Down
2 changes: 0 additions & 2 deletions crates/facet-core/src/vault/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@
// Metaform Systems, Inc. - initial API and implementation
//

#[cfg(test)]
mod hashicorp;
#[cfg(test)]
mod mem;
9 changes: 4 additions & 5 deletions crates/facet-core/tests/token_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@
// Metaform Systems, Inc. - initial API and implementation
//

mod common;

use crate::common::setup_postgres_container;
use chrono::{TimeDelta, Utc};
use dsdk_facet_core::context::ParticipantContext;
use dsdk_facet_core::jwt::jwtutils::{
StaticSigningKeyResolver, StaticVerificationKeyResolver, generate_ed25519_keypair_pem,
};
use dsdk_facet_core::jwt::{JwtVerifier, LocalJwtGenerator, LocalJwtVerifier};
use dsdk_facet_core::lock::PostgresLockManager;
use dsdk_facet_core::token::oauth::OAuth2TokenClient;
use dsdk_facet_core::token::{PostgresTokenStore, TokenClientApi, TokenData, TokenStore};
use dsdk_facet_core::token::{TokenClientApi, TokenData, TokenStore};
use dsdk_facet_core::util::clock::default_clock;
use dsdk_facet_core::util::encryption::encryption_key;
use dsdk_facet_postgres::lock::PostgresLockManager;
use dsdk_facet_postgres::token::PostgresTokenStore;
use dsdk_facet_testcontainers::postgres::setup_postgres_container;
use once_cell::sync::Lazy;
use sodiumoxide::crypto::secretbox;
use std::sync::Arc;
Expand Down
22 changes: 22 additions & 0 deletions crates/facet-hashicorp-vault/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "dsdk-facet-hashicorp-vault"
version.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
dsdk-facet-core = { path = "../facet-core" }
bon = { workspace = true }
rand = { workspace = true }
tokio = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
log = { workspace = true }
reqwest = { workspace = true }
async-trait = { workspace = true }
chrono = { workspace = true }


[dev-dependencies]
wiremock = { workspace = true }
dsdk-facet-testcontainers = { path = "../facet-testcontainers" }
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
// Metaform Systems, Inc. - initial API and implementation
//

use crate::vault::VaultError;
use async_trait::async_trait;
use bon::Builder;
use dsdk_facet_core::vault::VaultError;
use reqwest::Client;
use serde::{Deserialize, Serialize};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use super::auth::{JwtVaultAuthClient, VaultAuthClient, handle_error_response};
use super::config::{CONTENT_KEY, DEFAULT_ROLE, HashicorpVaultConfig};
use super::renewal::{RenewalHandle, TokenRenewer};
use super::state::VaultClientState;
use crate::context::ParticipantContext;
use crate::util::clock::Clock;
use crate::vault::{VaultClient, VaultError};
use async_trait::async_trait;
use dsdk_facet_core::context::ParticipantContext;
use dsdk_facet_core::util::clock::Clock;
use dsdk_facet_core::vault::{VaultClient, VaultError};
use reqwest::{Client, StatusCode};
use serde::{Deserialize, Serialize};
use std::sync::Arc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
// Metaform Systems, Inc. - initial API and implementation
//

use crate::util::clock::{Clock, default_clock};
use crate::vault::VaultError;
use bon::Builder;
use dsdk_facet_core::util::clock::{Clock, default_clock};
use dsdk_facet_core::vault::VaultError;
use std::sync::Arc;
use std::time::Duration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ pub mod renewal;
#[doc(hidden)]
pub mod state;

#[cfg(test)]
mod tests;

pub use client::HashicorpVaultClient;
pub use config::{ErrorCallback, HashicorpVaultConfig, HashicorpVaultConfigBuilder};
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use super::config::{
DEFAULT_MAX_CONSECUTIVE_FAILURES, DEFAULT_RENEWAL_JITTER, DEFAULT_TOKEN_RENEWAL_PERCENTAGE, ErrorCallback,
};
use super::state::VaultClientState;
use crate::util::backoff::{BackoffConfig, calculate_backoff_interval};
use crate::util::clock::Clock;
use crate::vault::VaultError;
use bon::Builder;
use dsdk_facet_core::util::backoff::{BackoffConfig, calculate_backoff_interval};
use dsdk_facet_core::util::clock::Clock;
use dsdk_facet_core::vault::VaultError;
use log::{debug, error};
use rand::Rng;
use reqwest::Client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
// Metaform Systems, Inc. - initial API and implementation
//

use crate::util::clock::{Clock, MockClock};
use crate::vault::VaultError;
use crate::vault::hashicorp::auth::VaultAuthClient;
use crate::vault::hashicorp::config::ErrorCallback;
use crate::vault::hashicorp::renewal::TokenRenewer;
use crate::vault::hashicorp::state::VaultClientState;
use crate::auth::VaultAuthClient;
use crate::config::ErrorCallback;
use crate::renewal::TokenRenewer;
use crate::state::VaultClientState;
use async_trait::async_trait;
use chrono::{TimeDelta, Utc};
use dsdk_facet_core::util::clock::{Clock, MockClock};
use dsdk_facet_core::vault::VaultError;
use reqwest::Client;
use std::sync::Arc;
use std::time::Duration;
Expand Down
1 change: 1 addition & 0 deletions crates/facet-hashicorp-vault/src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod client;
Loading