You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tw...@apache.org on 2021/10/23 23:05:53 UTC

[mina-sshd] 01/05: UserAuthPublicKey: make creating the key iterator overrideable

This is an automated email from the ASF dual-hosted git repository.

twolf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 445dea2ed6a769caee8805aeea1348468413331f
Author: Thomas Wolf <tw...@apache.org>
AuthorDate: Sat Oct 23 20:48:27 2021 +0200

    UserAuthPublicKey: make creating the key iterator overrideable
    
    Introduce a protected factory method.
---
 .../java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java
index 96efa12..ec0d697 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/pubkey/UserAuthPublicKey.java
@@ -89,7 +89,7 @@ public class UserAuthPublicKey extends AbstractUserAuth implements SignatureFact
         releaseKeys(); // just making sure in case multiple calls to the method
 
         try {
-            keys = new UserAuthPublicKeyIterator(session, this);
+            keys = createPublicKeyIterator(session, this);
         } catch (Error e) {
             warn("init({})[{}] failed ({}) to initialize session keys: {}",
                     session, service, e.getClass().getSimpleName(), e.getMessage(), e);
@@ -97,6 +97,11 @@ public class UserAuthPublicKey extends AbstractUserAuth implements SignatureFact
         }
     }
 
+    protected Iterator<PublicKeyIdentity> createPublicKeyIterator(ClientSession session, SignatureFactoriesManager manager)
+            throws Exception {
+        return new UserAuthPublicKeyIterator(session, manager);
+    }
+
     @Override
     protected boolean sendAuthDataRequest(ClientSession session, String service) throws Exception {
         boolean debugEnabled = log.isDebugEnabled();