Skip to content

Commit f8358b9

Browse files
Change artifactory authorization to bearer (#94)
According to https://jfrog.com/help/r/jfrog-platform-administration-documentation/api-key, API keys are being deprecated and we should be using Bearer authentication Also bumping version to 1.6.2 for small patch release --------- Co-authored-by: Raymond Ng <raymondnumbergenerator@proton.me>
1 parent c57e712 commit f8358b9

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ default-members = [".", "artiaa_auth"]
66
[package]
77
name = "foreman"
88
description = "Toolchain manager for simple binary tools"
9-
version = "1.6.1"
9+
version = "1.6.2"
1010
authors = [
1111
"Lucien Greathouse <me@lpghatguy.com>",
1212
"Matt Hargett <plaztiksyke@gmail.com>",

src/tool_provider/artifactory.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ use serde::{Deserialize, Serialize};
1414
use std::collections::HashMap;
1515
use url::Url;
1616

17-
const ARTIFACTORY_API_KEY_HEADER: &str = "X-JFrog-Art-Api";
18-
1917
#[derive(Debug)]
2018
pub struct ArtifactoryProvider {
2119
paths: ForemanPaths,
@@ -42,7 +40,7 @@ impl ToolProviderImpl for ArtifactoryProvider {
4240
.map_err(|error| ForemanError::ArtiAAError { error })?;
4341

4442
if let Some(credentials) = tokens.get_credentials(host) {
45-
builder = builder.header(ARTIFACTORY_API_KEY_HEADER, credentials.token.to_string());
43+
builder = builder.header(AUTHORIZATION, format!("Bearer {}", credentials.token));
4644
}
4745
log::debug!("Downloading artifactory releases for {}", repo);
4846
let response_body = builder
@@ -98,7 +96,7 @@ impl ToolProviderImpl for ArtifactoryProvider {
9896

9997
let tokens = artiaa_auth::Tokens::load(&self.paths.artiaa_path()?).unwrap();
10098
if let Some(credentials) = tokens.get_credentials(&artifactory_url) {
101-
builder = builder.header(AUTHORIZATION, format!("bearer {}", credentials.token));
99+
builder = builder.header(AUTHORIZATION, format!("Bearer {}", credentials.token));
102100
}
103101

104102
log::debug!("Downloading release asset {}", url);

tests/snapshots/help_command.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source: tests/cli.rs
33
assertion_line: 100
44
expression: content
55
---
6-
foreman 1.6.1
6+
foreman 1.6.2
77

88
USAGE:
99
foreman [FLAGS] <SUBCOMMAND>

0 commit comments

Comments
 (0)