Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing cloudsmith and migration to IOS v.1.0.0 #2

Merged
merged 9 commits into from
Apr 15, 2024
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
3 changes: 0 additions & 3 deletions .cargo/config

This file was deleted.

92 changes: 53 additions & 39 deletions Cargo.lock

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

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@ actix = "0.13.1"
actix-cors = "0.7.0"
actix-governor = "0.5.0"
actix-web = "4.5.1"
actix-web-actors = "4.2.0"
actix-web-lab = "0.20.2"
anyhow = "1.0.79"
chrono = { version = "0.4.33", features = ["serde"] }
dotenvy = "0.15.7"
envconfig = "0.10.0"
futures = "0.3.30"
handlebars = "5.1.1"
integrationos-domain = { version = "0.1.3", features = ["dummy", "actix-error"] }
integrationos-domain = { version = "1.3.0", features = ["dummy", "actix-error"] }
jsonwebtoken = "9.2.0"
moka = { version = "0.12.5", features = ["future"] }
mongodb = "2.8.0"
reqwest = "0.11.24"
serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
thiserror = "1.0.56"
tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] }
tracing = { version = "0.1.40", features = ["log"] }
tracing-actix-web = "0.7.9"
Expand All @@ -42,9 +40,7 @@ name = "oauth-api"
path = "src/main.rs"

[dev-dependencies]
derive = "1.0.0"
fake = { version = "=2.9.1", features = ["dummy"] }
features = "0.10.0"
mark-flaky-tests = { version = "1.0.2", features = ["tokio"] }
once_cell = "1.19.0"
rand = "0.8.5"
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# OAuth API

This is an API that uses OAuth2.0 blueprints to both refresh tokens and provide user authentication
for more complex workflows (like Xero OAuth).
This is an API that uses OAuth2.0 blueprints to both refresh tokens and trigger the authorization code flow.
12 changes: 6 additions & 6 deletions src/algebra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ pub use trigger::*;

use chrono::{DateTime, Utc};
use integrationos_domain::{
algebra::adapter::StoreAdapter, error::IntegrationOSError as Error, mongo::MongoDbStore,
Connection, Id,
algebra::{MongoStore, StoreExt},
Connection, Id, IntegrationOSError,
};
use mongodb::bson::doc;

pub async fn get_connections_to_refresh(
collection: &MongoDbStore<Connection>,
collection: &MongoStore<Connection>,
refresh_before: &DateTime<Utc>,
refresh_after: &DateTime<Utc>,
) -> Result<Vec<Connection>, Error> {
) -> Result<Vec<Connection>, IntegrationOSError> {
collection
.get_many(
Some(doc! {
Expand All @@ -37,9 +37,9 @@ pub async fn get_connections_to_refresh(
}

pub async fn get_connection_to_trigger(
collection: &MongoDbStore<Connection>,
collection: &MongoStore<Connection>,
id: Id,
) -> Result<Option<Connection>, Error> {
) -> Result<Option<Connection>, IntegrationOSError> {
collection
.get_one(doc! {
"_id": id.to_string(),
Expand Down
13 changes: 7 additions & 6 deletions src/algebra/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@ use actix::prelude::*;
use chrono::{Duration, Utc};
use futures::lock::Mutex;
use integrationos_domain::{
connection_oauth_definition::ConnectionOAuthDefinition, error::IntegrationOSError as Error,
mongo::MongoDbStore, service::secrets_client::SecretsClient, Connection, InternalError,
algebra::MongoStore, connection_oauth_definition::ConnectionOAuthDefinition,
error::IntegrationOSError as Error, service::secrets_client::SecretsClient, Connection,
InternalError,
};
use reqwest::Client;
use std::sync::Arc;

pub struct RefreshActor {
connections: Arc<MongoDbStore<Connection>>,
oauths: Arc<MongoDbStore<ConnectionOAuthDefinition>>,
connections: Arc<MongoStore<Connection>>,
oauths: Arc<MongoStore<ConnectionOAuthDefinition>>,
secrets: Arc<SecretsClient>,
client: Client,
state: Arc<Mutex<StatefulActor>>,
}

impl RefreshActor {
pub fn new(
oauths: Arc<MongoDbStore<ConnectionOAuthDefinition>>,
connections: Arc<MongoDbStore<Connection>>,
oauths: Arc<MongoStore<ConnectionOAuthDefinition>>,
connections: Arc<MongoStore<Connection>>,
secrets: Arc<SecretsClient>,
client: Client,
) -> Self {
Expand Down
Loading
Loading