void SendServerMechanisms() { List <AmqpSymbol> mechanisms = new List <AmqpSymbol>(); foreach (string mechanism in this.provider.Mechanisms) { mechanisms.Add(new AmqpSymbol(mechanism)); } SaslMechanisms salsMechanisms = new SaslMechanisms(); salsMechanisms.SaslServerMechanisms = new Multiple <AmqpSymbol>(mechanisms); this.state = SaslState.WaitingForInit; this.WriteFrame(salsMechanisms, true); }
/// <summary> /// Client receives the announced server mechanisms. /// </summary> void OnSaslServerMechanisms(SaslMechanisms mechanisms) { if (this.state != SaslState.WaitingForServerMechanisms) { throw new AmqpException(AmqpErrorCode.IllegalState, AmqpResources.GetString(AmqpResources.AmqpIllegalOperationState, "R:SASL-MECH", this.state)); } string mechanismToUse = null; foreach (string mechanism in this.provider.Mechanisms) { if (mechanisms.SaslServerMechanisms.Contains(new AmqpSymbol(mechanism))) { mechanismToUse = mechanism; break; } if (mechanismToUse != null) { break; } } if (mechanismToUse == null) { throw new AmqpException( AmqpErrorCode.NotFound, AmqpResources.GetString(AmqpResources.AmqpNotSupportMechanism, mechanisms.SaslServerMechanisms.ToString(), string.Join(",", this.provider.Mechanisms))); } this.state = SaslState.Negotiating; this.saslHandler = this.provider.GetHandler(mechanismToUse, true); SaslInit init = new SaslInit(); init.Mechanism = mechanismToUse; this.saslHandler.Start(this, init, true); }
void SendServerMechanisms() { List<AmqpSymbol> mechanisms = new List<AmqpSymbol>(); foreach (string mechanism in this.provider.Mechanisms) { mechanisms.Add(new AmqpSymbol(mechanism)); } SaslMechanisms salsMechanisms = new SaslMechanisms(); salsMechanisms.SaslServerMechanisms = new Multiple<AmqpSymbol>(mechanisms); this.state = SaslState.WaitingForInit; this.WriteFrame(salsMechanisms, true); }