I’m trying to upload a file via the components API and it’s returning a 400 “Not authorized for requested path” error.
Sonatype Nexus Repository: OSS 3.59.0-01
$ curl -v -X 'POST' \
-H "Authorization: ****************" \
'https://artifacts.eas.wwu.edu/service/rest/v1/components?repository=maven-3rd-party' \
-H 'Accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'maven2.groupId=com.ellucian' \
-F 'maven2.artifactId=banner-application-navigator' \
-F 'maven2.version=2.1' \
-F 'maven2.generate-pom=true' \
-F 'maven2.packaging=zip' \
-F 'maven2.asset1=@release-applicationNavigator-2.1.zip;type=application/zip' \
-F 'maven2.asset1.extension=zip'
Note: Unnecessary use of -X or --request, POST is already inferred.
* processing: https://artifacts.eas.wwu.edu/service/rest/v1/components?repository=maven-3rd-party
* Trying 140.160.232.66:443...
* Connected to artifacts.eas.wwu.edu (140.160.232.66) port 443
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: /opt/local/share/curl/curl-ca-bundle.crt
* CApath: none
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: C=US; ST=Washington; O=Western Washington University; CN=*.eas.wwu.edu
* start date: May 23 00:00:00 2023 GMT
* expire date: May 22 23:59:59 2024 GMT
* subjectAltName: host "artifacts.eas.wwu.edu" matched cert's "*.eas.wwu.edu"
* issuer: C=US; ST=MI; L=Ann Arbor; O=Internet2; OU=InCommon; CN=InCommon ECC Server CA
* SSL certificate verify ok.
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* using HTTP/2
* h2 [:method: POST]
* h2 [:scheme: https]
* h2 [:authority: artifacts.eas.wwu.edu]
* h2 [:path: /service/rest/v1/components?repository=maven-3rd-party]
* h2 [user-agent: curl/8.2.1]
* h2 [authorization: **************]
* h2 [accept: application/json]
* h2 [content-length: 110106767]
* h2 [content-type: multipart/form-data; boundary=------------------------257d6a2677602917]
* Using Stream ID: 1
> POST /service/rest/v1/components?repository=maven-3rd-party HTTP/2
> Host: artifacts.eas.wwu.edu
> User-Agent: curl/8.2.1
> Authorization: ****************
> Accept: application/json
> Content-Length: 110106767
> Content-Type: multipart/form-data; boundary=------------------------257d6a2677602917
>
* We are completely uploaded and fine
< HTTP/2 400
< content-type: application/json
< date: Sat, 02 Sep 2023 21:14:22 GMT
< server: Nexus/3.59.0-01 (OSS)
< vary: Accept
< x-content-type-options: nosniff
< x-siesta-faultid: 5a1e7282-5dc7-437a-a830-0ecedbf6c895
< content-length: 156
<
[ {
"id" : "*",
"message" : "Not authorized for requested path 'com/ellucian/banner-application-navigator/2.1/banner-application-navigator-2.1.zip'"
* Connection #0 to host artifacts.eas.wwu.edu left intact
} ]
The user has these privileges:
nx-component-upload
nx-repository-view-maven2-maven-3rd-party-*
These relevant messages are in the log:
nexus-nexus-repository-manager-f5c84f7d5-rc6g5 nexus-repository-manager 2023-09-02 21:02:03,263+0000 INFO [qtp785501274-401] *UNKNOWN org.sonatype.nexus.repository.upload.internal.OrientUploadManagerImpl - Uploading component with parameters: repository="maven-3rd-party" format="maven2" groupId="com.ellucian" generate-pom="true" packaging="zip" artifactId="banner-application-navigator" version="2.1"
nexus-nexus-repository-manager-f5c84f7d5-rc6g5 nexus-repository-manager 2023-09-02 21:02:03,264+0000 INFO [qtp785501274-401] *UNKNOWN org.sonatype.nexus.repository.upload.internal.OrientUploadManagerImpl - Asset with parameters: file="release-applicationNavigator-2.1.zip" extension="zip"
nexus-nexus-repository-manager-f5c84f7d5-rc6g5 nexus-repository-manager 2023-09-02 21:02:03,355+0000 WARN [qtp785501274-401] *UNKNOWN org.sonatype.nexus.siesta.internal.ValidationErrorsExceptionMapper - (ID f5d43bb4-a73e-40b0-a59c-7eac176cddbf) Response: [400] '[ValidationErrorXO{id='*', message='Not authorized for requested path 'com/ellucian/banner-application-navigator/2.1/banner-application-navigator-2.1.zip''}]'; mapped from: org.sonatype.nexus.rest.ValidationErrorsException: Not authorized for requested path 'com/ellucian/banner-application-navigator/2.1/banner-application-navigator-2.1.zip'
I’ve also tried with my username/password which has nx-all
, and it gets the same response. What am I missing?
Thanks!