Skip to content

Commit

Permalink
Change artifactory authorization to bearer (#94)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
afujiwara-roblox and raymondnumbergenerator authored Apr 18, 2024
1 parent c57e712 commit f8358b9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default-members = [".", "artiaa_auth"]
[package]
name = "foreman"
description = "Toolchain manager for simple binary tools"
version = "1.6.1"
version = "1.6.2"
authors = [
"Lucien Greathouse <me@lpghatguy.com>",
"Matt Hargett <plaztiksyke@gmail.com>",
Expand Down
6 changes: 2 additions & 4 deletions src/tool_provider/artifactory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use url::Url;

const ARTIFACTORY_API_KEY_HEADER: &str = "X-JFrog-Art-Api";

#[derive(Debug)]
pub struct ArtifactoryProvider {
paths: ForemanPaths,
Expand All @@ -42,7 +40,7 @@ impl ToolProviderImpl for ArtifactoryProvider {
.map_err(|error| ForemanError::ArtiAAError { error })?;

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

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

log::debug!("Downloading release asset {}", url);
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/help_command.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: tests/cli.rs
assertion_line: 100
expression: content
---
foreman 1.6.1
foreman 1.6.2

USAGE:
foreman [FLAGS] <SUBCOMMAND>
Expand Down

0 comments on commit f8358b9

Please sign in to comment.