| | |
| | | import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory; |
| | | import org.apache.sshd.common.keyprovider.FileKeyPairProvider; |
| | | import org.apache.sshd.common.util.SecurityUtils; |
| | | import org.apache.sshd.server.auth.CachingPublicKeyAuthenticator; |
| | | import org.apache.sshd.server.UserAuth; |
| | | import org.apache.sshd.server.auth.CachingPublicKeyAuthenticator; |
| | | import org.apache.sshd.server.auth.UserAuthKeyboardInteractive; |
| | | import org.apache.sshd.server.auth.UserAuthPassword; |
| | | import org.apache.sshd.server.auth.UserAuthPublicKey; |
| | |
| | | } |
| | | |
| | | public String formatUrl(String gituser, String servername, String repository) { |
| | | if (sshd.getPort() == DEFAULT_PORT) { |
| | | IStoredSettings settings = gitblit.getSettings(); |
| | | |
| | | int port = sshd.getPort(); |
| | | int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port); |
| | | String displayServername = settings.getString(Keys.git.sshAdvertisedHost, ""); |
| | | if(displayServername.isEmpty()) { |
| | | displayServername = servername; |
| | | } |
| | | if (displayPort == DEFAULT_PORT) { |
| | | // standard port |
| | | return MessageFormat.format("ssh://{0}@{1}/{2}", gituser, servername, |
| | | return MessageFormat.format("ssh://{0}@{1}/{2}", gituser, displayServername, |
| | | repository); |
| | | } else { |
| | | // non-standard port |
| | | return MessageFormat.format("ssh://{0}@{1}:{2,number,0}/{3}", |
| | | gituser, servername, sshd.getPort(), repository); |
| | | gituser, displayServername, displayPort, repository); |
| | | } |
| | | } |
| | | |