JGitPasswordAuthFactory.java

  1. /*
  2.  * Copyright (C) 2018, 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.AbstractUserAuthFactory;
  13. import org.apache.sshd.client.auth.password.UserAuthPassword;
  14. import org.apache.sshd.client.auth.password.UserAuthPasswordFactory;
  15. import org.apache.sshd.client.session.ClientSession;

  16. /**
  17.  * A customized {@link UserAuthPasswordFactory} that creates instance of
  18.  * {@link JGitPasswordAuthentication}.
  19.  */
  20. public class JGitPasswordAuthFactory extends AbstractUserAuthFactory {

  21.     /** The singleton {@link JGitPasswordAuthFactory}. */
  22.     public static final JGitPasswordAuthFactory INSTANCE = new JGitPasswordAuthFactory();

  23.     private JGitPasswordAuthFactory() {
  24.         super(UserAuthPasswordFactory.NAME);
  25.     }

  26.     @Override
  27.     public UserAuthPassword createUserAuth(ClientSession session)
  28.             throws IOException {
  29.         return new JGitPasswordAuthentication();
  30.     }
  31. }