Artifactory can serve the file as a filtered resource on npm repositories and a filtered textual resource is processed by the FreeMarker engine before being returned to clients. The context accessible to the template includes: Properties, Security and Request.
In order to utilize the filtered resource, we would need to follow the below steps
Step 1: Deploy a .npmrc file to any of the npm local repositories available in Artifactory with the following configuration.
Step 2: Mark this file as a filtered resource in Artifactory
Step 3: Try to download the . npmrc file using the cURL command as
and it is expected to get the file updated “.npmrc” with relevant user details who tried to download the file as shown below. To deploy
In order to utilize the filtered resource, we would need to follow the below steps
Step 1: Deploy a .npmrc file to any of the npm local repositories available in Artifactory with the following configuration.
_auth = "${security.getEncryptedPassword()!"**** Insert encrypted password here **** "}" email = "${security.currentUser().getEmail()!"**** Insert EMAIL here **** "}" always-auth = true
Step 2: Mark this file as a filtered resource in Artifactory
Step 3: Try to download the . npmrc file using the cURL command as
$ curl -H "uusername:password" -T ./.npmrc "http://<artifactoryurl>:<port>/artifactory/<repository-name>/.npmrc"
and it is expected to get the file updated “.npmrc” with relevant user details who tried to download the file as shown below. To deploy
.npmrc:<curl command>Downloaded npmrc after applying filtered resource:
_auth = "xyz" email = "xyz@gmail.com" always-auth = true