fix: enable aws auth passthrough (#4825)

This commit is contained in:
Shreyas 2025-03-05 18:31:59 +05:30 committed by GitHub
parent 8be8178b05
commit 42f90d3f05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 71 additions and 9 deletions

View file

@ -4020,7 +4020,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "relay"
version = "0.1.1"
source = "git+https://github.com/CuriousCorrelation/relay.git#0a314ed5b71c74349d55f8213d57afbbe55abb87"
source = "git+https://github.com/CuriousCorrelation/relay.git#d258a2c1557b9da0715681a1f267a686eb4920bb"
dependencies = [
"bytes",
"curl",

View file

@ -33,10 +33,32 @@ impl<'a> AuthHandler<'a> {
tracing::info!(username = %username, "Setting digest auth");
self.set_digest_auth(username, password)
}
AuthType::ApiKey { key, value, location } => {
AuthType::ApiKey {
key,
value,
location,
} => {
tracing::info!(key = %key, "Setting API key auth");
self.set_apikey_auth(key, value, location)
}
AuthType::Aws {
access_key,
secret_key,
region,
service,
session_token,
location,
} => {
tracing::debug!("AWS SigV4 auth is handled at application level");
self.set_aws_auth(
access_key,
secret_key,
region,
service,
session_token.as_deref(),
location,
)
}
AuthType::OAuth2 {
grant_type,
access_token,
@ -108,6 +130,19 @@ impl<'a> AuthHandler<'a> {
Ok(())
}
fn set_aws_auth(
&mut self,
_access_key: &str,
_secret_key: &str,
_region: &str,
_service: &str,
_session_token: Option<&str>,
_location: &ApiKeyLocation,
) -> Result<()> {
tracing::debug!("AWS SigV4 auth is handled at application level");
Ok(())
}
fn set_digest_auth(&mut self, username: &str, password: &str) -> Result<()> {
tracing::debug!("Setting up digest authentication");
self.set_basic_auth(username, password)?;

View file

@ -183,6 +183,16 @@ pub enum AuthType {
access_token: Option<String>,
refresh_token: Option<String>,
},
#[serde(rename_all = "camelCase")]
Aws {
access_key: String,
secret_key: String,
region: String,
service: String,
session_token: Option<String>,
#[serde(rename = "in")]
location: ApiKeyLocation,
},
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]

View file

@ -112,6 +112,14 @@ export type AuthType = {
key: string;
value: string;
in: "header" | "query";
} | {
kind: "aws";
accessKey: string;
secretKey: string;
region: string;
service: string;
sessionToken?: string;
in: "header" | "query";
};
export type CertificateType = {
kind: "pem";

File diff suppressed because one or more lines are too long

View file

@ -165,6 +165,15 @@ export type AuthType =
value: string
in: "header" | "query"
}
| {
kind: "aws"
accessKey: string
secretKey: string
region: string
service: string
sessionToken?: string
in: "header" | "query"
}
export type CertificateType =
| {

View file

@ -3956,7 +3956,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "relay"
version = "0.1.1"
source = "git+https://github.com/CuriousCorrelation/relay.git#0a314ed5b71c74349d55f8213d57afbbe55abb87"
source = "git+https://github.com/CuriousCorrelation/relay.git#d258a2c1557b9da0715681a1f267a686eb4920bb"
dependencies = [
"bytes",
"curl",
@ -5081,7 +5081,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-relay"
version = "0.1.0"
source = "git+https://github.com/CuriousCorrelation/tauri-plugin-relay#40371f227b75f13dfe1e03273b119326070f6306"
source = "git+https://github.com/CuriousCorrelation/tauri-plugin-relay#4b96e40170c65189144299d896b7e97803f13cca"
dependencies = [
"relay",
"serde",

View file

@ -1180,7 +1180,7 @@ importers:
dependencies:
'@hoppscotch/plugin-relay':
specifier: github:CuriousCorrelation/tauri-plugin-relay
version: '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/40371f227b75f13dfe1e03273b119326070f6306'
version: '@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/4b96e40170c65189144299d896b7e97803f13cca'
'@tauri-apps/api':
specifier: 2.1.1
version: 2.1.1
@ -1809,8 +1809,8 @@ packages:
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/e44d90aefb8d930044643b41fa1ce739e49d456c}
version: 0.1.0
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/40371f227b75f13dfe1e03273b119326070f6306':
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/40371f227b75f13dfe1e03273b119326070f6306}
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/4b96e40170c65189144299d896b7e97803f13cca':
resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/4b96e40170c65189144299d896b7e97803f13cca}
version: 0.1.0
'@alloc/quick-lru@5.2.0':
@ -13236,7 +13236,7 @@ snapshots:
dependencies:
'@tauri-apps/api': 2.1.1
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/40371f227b75f13dfe1e03273b119326070f6306':
'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/4b96e40170c65189144299d896b7e97803f13cca':
dependencies:
'@tauri-apps/api': 2.1.1