在启用LDAP的情况下,无法使用加密密码部署工件

Tec*_*ext 10 artifactory maven-3 maven

我们正在使用Artifactory Version 4.7.0.我已经为Artifactory配置了LDAP,我能够成功登录.当我尝试使用加密密码来部署工件时,它无法正常工作.在Artifacts选项卡中,我点击"Set Me Up"并在输入我的凭据后生成Maven设置.然后我下载了settings.xml文件,其中包含以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>${security.getCurrentUsername()}</username>
      <password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password>
      <id>central</id>
    </server>
    <server>
      <username>${security.getCurrentUsername()}</username>
      <password>${security.getEscapedEncryptedPassword()!"*** Insert encrypted password here ***"}</password>
      <id>snapshots</id>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://artifactory:9090/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://artifactory:9090/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>http://artifactory:9090/plugins-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>plugins-snapshot</name>
          <url>http://artifactory:9090/plugins-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>
Run Code Online (Sandbox Code Playgroud)

然后我转到我的个人资料,输入密码并复制加密密码,如下所示:

在此输入图像描述

我在settings.xml中复制了这个密码,如下所示:

    <server>
      <username>${security.getCurrentUsername()}</username>
      <password>${security.getEscapedEncryptedPassword()!"AP6FcvsVawZhcfEdZB2PCTrCUZa"}</password>
      <id>central</id>
    </server>
    <server>
      <username>${security.getCurrentUsername()}</username>  
      <password>${security.getEscapedEncryptedPassword()!"AP6FcvsVawZhcfEdZB2PCTrCUZa"}</password>
      <id>snapshots</id>
    </server>
Run Code Online (Sandbox Code Playgroud)

然后当我尝试部署工件时,我收到以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project more-maven-examples: Failed to deploy artifac
ts: Could not transfer artifact com.infiniteskills.maven:more-maven-examples:jar:1.0 from/to central (http://artifactory:9090/libs-release-local):
Failed to transfer file: http://artifactory:9090/libs-release-local/com/infiniteskills/maven/more-maven-examples/1.0/more-maven-examples-1.0.jar. R
eturn code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
Run Code Online (Sandbox Code Playgroud)

request.log文件中输入失败的尝试:

20160525143037|9526|REQUEST|10.20.55.124|non_authenticated_user|PUT|/libs-release-local/com/infiniteskills/maven/more-maven-examples/1.0/more-maven-examples-1.0.jar|HTTP/1.1|401|2981
20160525143037|2|REQUEST|10.20.55.124|non_authenticated_user|PUT|/libs-release-local/com/infiniteskills/maven/more-maven-examples/1.0/more-maven-examples-1.0.pom|HTTP/1.1|401|1235
Run Code Online (Sandbox Code Playgroud)

在安全性>常规>密码加密策略设置为SUPPORTED.此外,密码加密设置为加密.

令人惊讶的是,当我在同一个块的settings.xml文件中硬编码我的名字和LDAP密码时<server>,它工作正常.

我做错了什么或者它是一个错误?

小智 5

将整行替换为您的凭据

<username>actual-username-here</username>  
<password>your-encrypted-password-here</password>
Run Code Online (Sandbox Code Playgroud)

现在尝试一下。工作是一种享受。


car*_*ing 2

你的<password/>部分应该是这样的:

<password>{COQLCE6DU6GtcS5P=}</password>
Run Code Online (Sandbox Code Playgroud)

查看Maven 加密指南

  • @Technext - 你的 bug 受到关注了吗?在 Artifactory OSS 5.1.4 中,使用加密密码生成的 settings.xml 似乎仍然被破坏。 (2认同)