public async Task <IActionResult> OnAuthM5([FromBody] OnAuthM5Payload request) { var result = await AuthenticationM5(request); if (result != null && result is OkAuthM5Result item) { return(Ok(new { Result = "ok", Modifiers = new { item.Properties, Reason_code = item.ReasonCode } })); } return(result.GeneratePublicResult()); }
/// <summary> /// This method is called when new client is trying to authentication to sever SASL mechanism or when client is trying to re-authentication. /// To prevent the client to register return <see cref="ErrorResult"/> /// To ignore authentication for the client return <see cref="NextResult"/> /// To accept the client as a valid client return complex <see cref="OkAuthM5Result"/> to control client specific settings or simple <see cref="OkResult"/>. /// If you return another HookResult its meaning client is valid and caller ignore your result. /// For more information <see cref="https://docs.vernemq.com/plugin-development/sessionlifecycle#on_auth_m5"/> /// </summary> /// <param name="onAuthM5Payload">Authentication information include authentication data and authentication method</param> /// <returns>return value must be one of <see cref="OkResult"/> or <see cref="OkAuthM5Result"/> or <see cref="NextResult"/> or <see cref="ErrorResult"/> </returns> protected virtual async Task <HookResult> AuthenticationM5(OnAuthM5Payload onAuthM5Payload) { return(new OkResult()); }