[
https://issues.apache.org/jira/browse/MRESOLVER-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17819185#comment-17819185
]
ASF GitHub Bot commented on MRESOLVER-301:
------------------------------------------
michael-o commented on code in PR #432:
URL: https://github.com/apache/maven-resolver/pull/432#discussion_r1497322004
##########
maven-resolver-generator-signer/src/main/java/org/eclipse/aether/generator/signer/gpg/GpgAgentPasswordLoader.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.eclipse.aether.generator.signer.gpg;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.SocketException;
+import java.net.StandardProtocolFamily;
+import java.net.UnixDomainSocketAddress;
+import java.nio.channels.Channels;
+import java.nio.channels.SocketChannel;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.bouncycastle.util.encoders.Hex;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.sisu.Priority;
+
+@Singleton
+@Named(GpgAgentPasswordLoader.NAME)
+@Priority(10)
+@SuppressWarnings("checkstyle:magicnumber")
+public final class GpgAgentPasswordLoader implements
GpgSignerFactory.KeyPasswordLoader {
+ public static final String NAME = "agent";
+ private static final String[] SOCKET_LOCATIONS = new String[]
{".gnupg/S.gpg-agent"};
+
+ @Override
+ public boolean isInteractive() {
+ return true;
+ }
+
+ @Override
+ public char[] load(RepositorySystemSession session, long keyId) throws
IOException {
+ for (String socketLocation : SOCKET_LOCATIONS) {
+ try {
+ return load(keyId, Paths.get(System.getProperty("user.home"),
socketLocation))
+ .toCharArray();
+ } catch (SocketException e) {
+ // try next location
+ }
+ }
+ return null;
+ }
+
+ private String load(long keyId, Path socketPath) throws IOException {
+ try (SocketChannel sock =
SocketChannel.open(StandardProtocolFamily.UNIX)) {
+ try {
+ sock.connect(UnixDomainSocketAddress.of(socketPath));
+ } catch (SocketException e) {
+ System.out.println("Cannot connect to server on socket:" +
socketPath);
Review Comment:
Space after colon
> Artifact Generators
> -------------------
>
> Key: MRESOLVER-301
> URL: https://issues.apache.org/jira/browse/MRESOLVER-301
> Project: Maven Resolver
> Issue Type: New Feature
> Components: Resolver
> Reporter: Tamas Cservenak
> Assignee: Tamas Cservenak
> Priority: Major
> Fix For: 2.0.0
>
>
> Resolver should provide extension point for "generators". Typical use case
> for these are for example "signing" of artifacts.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)