JGitPublicKeyAuthFactory.java

  1. /*
  2.  * Copyright (C) 2018, 2021 Thomas Wolf <thomas.wolf@paranor.ch> and others
  3.  *
  4.  * This program and the accompanying materials are made available under the
  5.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  6.  * https://www.eclipse.org/org/documents/edl-v10.php.
  7.  *
  8.  * SPDX-License-Identifier: BSD-3-Clause
  9.  */
  10. package org.eclipse.jgit.internal.transport.sshd;

  11. import java.io.IOException;

  12. import org.apache.sshd.client.auth.pubkey.UserAuthPublicKey;
  13. import org.apache.sshd.client.auth.pubkey.UserAuthPublicKeyFactory;
  14. import org.apache.sshd.client.session.ClientSession;

  15. /**
  16.  * A customized authentication factory for public key user authentication.
  17.  */
  18. public class JGitPublicKeyAuthFactory extends UserAuthPublicKeyFactory {

  19.     /** The singleton {@link JGitPublicKeyAuthFactory}. */
  20.     public static final JGitPublicKeyAuthFactory FACTORY = new JGitPublicKeyAuthFactory();

  21.     private JGitPublicKeyAuthFactory() {
  22.         super();
  23.     }

  24.     @Override
  25.     public UserAuthPublicKey createUserAuth(ClientSession session)
  26.             throws IOException {
  27.         return new JGitPublicKeyAuthentication(getSignatureFactories());
  28.     }
  29. }