Skip to content
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

Restful API can't configure npm proxy repository bearer token authentication #247

Open
pcbmize opened this issue Sep 15, 2023 · 8 comments
Assignees

Comments

@pcbmize
Copy link

pcbmize commented Sep 15, 2023

  • What problem are you trying to solve?

    I'm attempting to configure an npm proxy repository that requires a Bearer Token for authentication via the restful API in Nexus 3.60.0 (though the problem has existed since at least 3.42.0).

    Configuring through the restful API allows us to leverage configuration as code along side the Helm 3 chart (which currently does not allow for configuring repositories through helm / kubernetes).

  • Do you have a workaround you are using at present?

    Not a good one: configuring it through the UI.

  • What feature or behavior is this required for?

    The RESTful API feature

  • How could we solve this issue? (Not knowing is okay!)

    In the /v1/repositories/npm/proxy api endpoint, support something like:

    "authentication": {
      "type": "bearerToken",
      "bearerToken": "<token>"
    }
    

    Presumably updating the swagger.json document (assuming that drives some sort of JSON Class Loader for HttpClient:

    [
      {
        "id": "BearerTokenAuthenticationConfiguration.attributes[httpclient].authentication.bearerToken",
        "message": "must not be blank"
      }
    ]
    
  • Tell us about your Nexus Repository deployment: what version, operating system, and database are you using?

    Sonatype Nexus Repository OSS 3.60.0-02
    Helm chart: nexus-repository-manager
    Chart version: 60.0.0

  • Anything else?

    It was noticed that with the API endpoint call, the application logs don't show the bearerToken property on the authentication object of httpclient:

    org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl - Creating repository: test2 -> OrientConfiguration{repositoryName='test2', recipeName='npm-proxy', attributes={proxy={contentMaxAge=1440, metadataMaxAge=1440, remoteUrl=<url>}, negativeCache={timeToLive=1440, enabled=true}, storage={strictContentTypeValidation=true, blobStoreName=proxy}, httpclient={blocked=false, autoBlock=true, connection=null, authentication={type=bearerToken}}}}
    

    However if the repository is configured through the UI (going through a different endpoint), authentication does show the bearerToken property.

    org.sonatype.nexus.repository.manager.internal.RepositoryManagerImpl - Updating repository: test -> OrientConfiguration{repositoryName='test2', recipeName='npm-proxy', attributes={proxy={remoteUrl=<url>, contentMaxAge=1440.0, metadataMaxAge=1440.0}, replication={preemptivePullEnabled=false}, httpclient={blocked=false, autoBlock=true, authentication={type=bearerToken, username=, password=****, ntlmHost=, ntlmDomain=, bearerToken=<token>}, connection={useTrustStore=false}}, storage={blobStoreName=proxy, strictContentTypeValidation=true}, negativeCache={enabled=true, timeToLive=1440.0}}}
    
@mrprescott
Copy link

Thanks for this suggestion, @pcbmize. We are looking at possible API enhancements in the future, we'll leave this open to gauge demand for this specific change.

@jsandas
Copy link

jsandas commented Oct 1, 2023

I too have just come across this issue. I am in the process of enhancing a module I wrote for SaltStack to automate configuration of Nexus 3. Part of the enhancement is to support alternative authentication methods for proxy repositories (preemptive bearer token and ntlm). However, I am observing the same behavior in which the @pcbmize has reported.

@yuvals41
Copy link

yuvals41 commented Nov 9, 2023

any updates?

im struggling with the same issue

@joris-git-321
Copy link

joris-git-321 commented Apr 12, 2024

Not sure, but this seems like somewhat crucial item that requires to fixed. Any ideas why it is not picked up? It is marked as "enhancement" however it is just a bug in the API.

@EugenMayer
Copy link

We are waiting since 2021 to have this fixed, not sure why this really needs so much effort or is ignored ( datadrivers/terraform-provider-nexus#158 )

Is there any chance to move this forward?

@joeyaurel
Copy link

@nblair @mrprescott Can you give us some kind of update? Maybe whether this issue is on the roadmap?

@joris-git-321
Copy link

The fact that this is not fixed yet is somewhat strange, having a powerful API is mandatory for automating proxy creation.

@Steel551454
Copy link

When you add bearerToken support to the API? This is a very important thing for managing a Nexus repository.

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

No branches or pull requests

9 participants