Skip to content

Resolve auth for Git providers that use tokens #6212

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tcrespog
Copy link
Collaborator

Those Git providers that rely on tokens for authentication (GitLab, Gitea, Bitbucket) do not need username and password to be defined too.

This PR tweaks the logic that determines whether a Git provider has authentication properties configured or not to take into account the sole presence of the token field.

@tcrespog tcrespog self-assigned this Jun 24, 2025
Copy link

netlify bot commented Jun 24, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 9e05091
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/685a66207ad5a3000861ece9

@pditommaso
Copy link
Member

pditommaso commented Jun 27, 2025

It may be better to override it in the class that has support for it. I only see it supported by these

@Override
protected String[] getAuth() {
if( config.token ) {
// set the token in the request header
// https://docs.gitea.io/en-us/api-usage/#authentication
return new String[] { "Authorization", "token $config.token" as String }
}
else {
return EMPTY_ARRAY
}
}

protected String[] getAuth() {
if( config.token ) {
// set the token in the request header
return new String[] { "PRIVATE-TOKEN", config.token }
}
if( config.password ) {
return new String[] { "PRIVATE-TOKEN", config.password }
}
return EMPTY_ARRAY
}

@tcrespog
Copy link
Collaborator Author

It may be better to override it in the class that has support for it. I only see it supported by these

The idea of adding it in the parent class is that more may come, such as #6209.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants