2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.test.tool;
12 import java.io.IOException;
13 import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
14 import org.opendaylight.controller.netconf.ssh.authentication.PEMGenerator;
16 class AcceptingAuthProvider implements AuthProvider {
17 private final String privateKeyPEMString;
19 public AcceptingAuthProvider() {
21 this.privateKeyPEMString = PEMGenerator.readOrGeneratePK(new File("PK"));
22 } catch (final IOException e) {
23 throw new RuntimeException(e);
28 public synchronized boolean authenticated(final String username, final String password) {
33 public char[] getPEMAsCharArray() {
34 return privateKeyPEMString.toCharArray();