forked from jshiffer/go-xmpp
Fix manual choice of auth mechanism. (#173)
This commit is contained in:
parent
5fdcf18a81
commit
424970d23c
9
xmpp.go
9
xmpp.go
@ -406,10 +406,12 @@ func (c *Client) init(o *Options) error {
|
||||
tlsConnOK = true
|
||||
}
|
||||
mechanism = ""
|
||||
switch {
|
||||
case slices.Contains(f.Mechanisms.Mechanism,
|
||||
o.Mechanism) && o.Mechanism != "":
|
||||
if o.Mechanism != "" {
|
||||
if slices.Contains(f.Mechanisms.Mechanism, o.Mechanism) {
|
||||
mechanism = o.Mechanism
|
||||
}
|
||||
} else {
|
||||
switch {
|
||||
case slices.Contains(f.Mechanisms.Mechanism,
|
||||
"SCRAM-SHA-512-PLUS") && tlsConnOK:
|
||||
mechanism = "SCRAM-SHA-512-PLUS"
|
||||
@ -438,6 +440,7 @@ func (c *Client) init(o *Options) error {
|
||||
"DIGEST-MD5"):
|
||||
mechanism = "DIGEST-MD5"
|
||||
}
|
||||
}
|
||||
if strings.HasPrefix(mechanism, "SCRAM-SHA") {
|
||||
if strings.HasSuffix(mechanism, "PLUS") {
|
||||
scramPlus = true
|
||||
|
Loading…
Reference in New Issue
Block a user