File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ type ServerConfig struct {
66
66
67
67
hostKeys []Signer
68
68
69
+ // ImplictAuthMethod is sent to the client in the list of acceptable
70
+ // authentication methods. To make an authentication decision based on
71
+ // connection metadata use NoClientAuthCallback. If NoClientAuthCallback is
72
+ // nil, the value is unused.
73
+ ImplictAuthMethod string
74
+
69
75
// NoClientAuth is true if clients are allowed to connect without
70
76
// authenticating.
71
77
// To determine NoClientAuth at runtime, set NoClientAuth to true
@@ -664,6 +670,9 @@ userAuthLoop:
664
670
665
671
if errors .Is (authErr , ErrDenied ) {
666
672
var failureMsg userAuthFailureMsg
673
+ if config .ImplictAuthMethod != "" {
674
+ failureMsg .Methods = []string {config .ImplictAuthMethod }
675
+ }
667
676
if err := s .transport .writePacket (Marshal (failureMsg )); err != nil {
668
677
return nil , err
669
678
}
@@ -698,6 +707,9 @@ userAuthLoop:
698
707
}
699
708
700
709
var failureMsg userAuthFailureMsg
710
+ if config .NoClientAuthCallback != nil && config .ImplictAuthMethod != "" {
711
+ failureMsg .Methods = append (failureMsg .Methods , config .ImplictAuthMethod )
712
+ }
701
713
if config .PasswordCallback != nil {
702
714
failureMsg .Methods = append (failureMsg .Methods , "password" )
703
715
}
You can’t perform that action at this time.
0 commit comments