View Javadoc
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  
12  import java.io.IOException;
13  
14  import org.apache.sshd.client.auth.pubkey.UserAuthPublicKey;
15  import org.apache.sshd.client.auth.pubkey.UserAuthPublicKeyFactory;
16  import org.apache.sshd.client.session.ClientSession;
17  
18  /**
19   * A customized authentication factory for public key user authentication.
20   */
21  public class JGitPublicKeyAuthFactory extends UserAuthPublicKeyFactory {
22  
23  	/** The singleton {@link JGitPublicKeyAuthFactory}. */
24  	public static final JGitPublicKeyAuthFactory FACTORY = new JGitPublicKeyAuthFactory();
25  
26  	private JGitPublicKeyAuthFactory() {
27  		super();
28  	}
29  
30  	@Override
31  	public UserAuthPublicKey createUserAuth(ClientSession session)
32  			throws IOException {
33  		return new JGitPublicKeyAuthentication(getSignatureFactories());
34  	}
35  }