public async Task <IActionResult> AuthOnRegisterM5([FromBody] AuthOnRegisterM5Payload request) { var result = await AuthenticationOnRegisterM5(request); if (result != null && result is OkAuthOnRegisterResult authResult) { return(Ok(new { Result = "ok", Modifiers = new { Max_message_size = authResult.MaxMessageSize, Max_inflight_messages = authResult.MaxInflightMessages, Retry_interval = authResult.RetryInterval } })); } return(result.GeneratePublicResult()); }
/// <summary> /// This method is called when new client is trying to authentication to server using MQTT v5. /// 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="OkAuthOnRegisterResult"/> 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#auth_on_register-and-auth_on_register_m5"/> /// </summary> /// <param name="authOnRegisterPayload">new client information</param> /// <returns>return value must be one of <see cref="OkResult"/> or <see cref="OkAuthOnRegisterResult"/> or <see cref="NextResult"/> or <see cref="ErrorResult"/> </returns> protected virtual async Task <HookResult> AuthenticationOnRegisterM5(AuthOnRegisterM5Payload authOnRegisterPayload) { return(new OkResult()); }