Shade mina-sshd
[netconf.git] / netconf / mdsal-netconf-ssh / src / main / java / org / opendaylight / netconf / ssh / SshProxyServerConfigurationBuilder.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.netconf.ssh;
9
10 import io.netty.channel.local.LocalAddress;
11 import java.net.InetSocketAddress;
12 import org.opendaylight.netconf.auth.AuthProvider;
13 import org.opendaylight.netconf.shaded.sshd.common.keyprovider.KeyPairProvider;
14 import org.opendaylight.netconf.shaded.sshd.server.auth.pubkey.PublickeyAuthenticator;
15
16 public final class SshProxyServerConfigurationBuilder {
17     private InetSocketAddress bindingAddress;
18     private LocalAddress localAddress;
19     private AuthProvider authenticator;
20     private KeyPairProvider keyPairProvider;
21     private int idleTimeout;
22     private PublickeyAuthenticator publickeyAuthenticator = null;
23
24     public SshProxyServerConfigurationBuilder setBindingAddress(final InetSocketAddress bindingAddress) {
25         this.bindingAddress = bindingAddress;
26         return this;
27     }
28
29     public SshProxyServerConfigurationBuilder setLocalAddress(final LocalAddress localAddress) {
30         this.localAddress = localAddress;
31         return this;
32     }
33
34     public SshProxyServerConfigurationBuilder setAuthenticator(final AuthProvider authenticator) {
35         this.authenticator = authenticator;
36         return this;
37     }
38
39     public SshProxyServerConfigurationBuilder setPublickeyAuthenticator(
40             final PublickeyAuthenticator publickeyAuthenticator) {
41         this.publickeyAuthenticator = publickeyAuthenticator;
42         return this;
43     }
44
45     public SshProxyServerConfigurationBuilder setKeyPairProvider(final KeyPairProvider keyPairProvider) {
46         this.keyPairProvider = keyPairProvider;
47         return this;
48     }
49
50     public SshProxyServerConfigurationBuilder setIdleTimeout(final int idleTimeout) {
51         this.idleTimeout = idleTimeout;
52         return this;
53     }
54
55     public SshProxyServerConfiguration createSshProxyServerConfiguration() {
56         return new SshProxyServerConfiguration(bindingAddress, localAddress, authenticator, publickeyAuthenticator,
57                 keyPairProvider, idleTimeout);
58     }
59
60     public static SshProxyServerConfigurationBuilder create() {
61         return new SshProxyServerConfigurationBuilder();
62     }
63 }