devopshq / devopshq/artifactory

Apikey-only authentication with pre-existing session

Open
#506 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
306
Forks
161
PR merge metrics
No merged PRs in 30d

Description

# Description

The `ArtifactoryPath` can be passed an existing session e.g. when many artifacts are planned to be uploaded at once to the same path. The session's `auth` attribute can be used to define an authentication method which is either password+username or apikey+username. However, using just the api key with pre-existing session is tricky: when a new ArtifactoryPath is constructed, the keyword argument `apikey` is only used if a __new__ session is [created](https://github.com/devopshq/artifactory/blob/master/artifactory.py#L1710). Subsequently, if a session with `auth` of __None__ and the keyword argument `apikey` are passed, authentication fails.

# Proposals for solution

1) If the passed session's `auth` attribute is __None__ but credentials are passed via keywords, attach them to the session. This is the simple solution but causes unexpected side effects by modifying the session.

2) Documentation is added to describe how to use the `XJFrogArtApiAuth` class from `auth.py` when using existing sessions, similarly how password and username can be used now. However, this causes some of the abstraction to leak.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in artifactory.py around the ArtifactoryPath session and apikey handling, then read auth.py for XJFrogArtApiAuth. Reproduce authentication with an existing session whose auth is None and an apikey, compare the two proposed approaches, and confirm that the chosen behavior authenticates successfully without unintended session changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.