Skip to content

Commit c88bdab

Browse files
committed
Add parameter authenticate
1 parent 5315889 commit c88bdab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

simple_server.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"net"
88
"net/url"
9+
"strconv"
910

1011
"github.com/wzshiming/sshd"
1112
"golang.org/x/crypto/ssh"
@@ -112,7 +113,9 @@ func serverConfig(addr string) (host, user, pwd string, config *ssh.ServerConfig
112113
}
113114
}
114115

115-
if config.PasswordCallback == nil && config.PublicKeyCallback == nil && config.KeyboardInteractiveCallback == nil {
116+
// must have be authenticated or not, default is false
117+
authenticate, _ := strconv.ParseBool(ur.Query().Get("authenticate"))
118+
if !authenticate && config.PasswordCallback == nil && config.PublicKeyCallback == nil && config.KeyboardInteractiveCallback == nil {
116119
config.NoClientAuth = true
117120
}
118121

0 commit comments

Comments
 (0)