<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="monospace">Hi,<br>
      <br>
      Natively, the auth_db supports only SQL databases.<br>
      <br>
      Options you have:<br>
      <br>
      1) try simulating an SQL DB from a noSQL one, by using the
      db_cachedb module [1]<br>
      <br>
      2) use the pv_proxy_authorize() function [2] and push the
      credentials from script level - and you can have the prior loaded
      from Mongo via the cache_fetch() [3] function.<br>
      <br>
      <br>
      [1] <a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/3.4.x/db_cachedb.html">https://opensips.org/html/docs/modules/3.4.x/db_cachedb.html</a><br>
      [2]
<a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/3.4.x/auth.html#func_pv_proxy_authorize">https://opensips.org/html/docs/modules/3.4.x/auth.html#func_pv_proxy_authorize</a><br>
      [3]
<a class="moz-txt-link-freetext" href="https://www.opensips.org/Documentation/Script-CoreFunctions-3-4#cache_fetch">https://www.opensips.org/Documentation/Script-CoreFunctions-3-4#cache_fetch</a><br>
      <br>
      Regards,<br>
    </font>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
  <a class="moz-txt-link-freetext" href="https://www.siphub.com">https://www.siphub.com</a></pre>
    <div class="moz-cite-prefix">On 11/1/23 9:07 AM, Harsh Patel via
      Users wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:PNZPR01MB8394E91BB767C6DE9496EB199AA7A@PNZPR01MB8394.INDPRD01.PROD.OUTLOOK.COM">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div style="font-family: Aptos, Aptos_EmbeddedFont,
        Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size:
        12pt; color: rgb(0, 0, 0);" class="elementToProof">
      </div>
      <div id="divRplyFwdMsg" dir="ltr" class="elementToProof"><span
          style=""> </span><span style="font-family: Aptos,
          Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica,
          sans-serif; font-size: 12pt;">I am currently using MySQL to
          proxy authorization using the </span><b style="font-family:
          Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri,
          Helvetica, sans-serif; font-size: 12pt; font-style: inherit;
          font-variant-ligatures: inherit; font-variant-caps: inherit;
          color: rgb(0, 0, 0);">auth_db</b><span style="font-family:
          Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri,
          Helvetica, sans-serif; font-size: 12pt;"> module. I am
          utilizing the </span><b style="font-family: Aptos,
          Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica,
          sans-serif; font-size: 12pt; font-style: inherit;
          font-variant-ligatures: inherit; font-variant-caps: inherit;
          color: rgb(0, 0, 0);">proxy_authorize</b><span
          style="font-family: Aptos, Aptos_EmbeddedFont,
          Aptos_MSFontService, Calibri, Helvetica, sans-serif;
          font-size: 12pt;"> function to authorize users in a MySQL
          table, and it is working perfectly.</span></div>
      <div dir="ltr">
        <div class="x_elementToProof x_ContentPasted1"
          style="font-family: Aptos, Aptos_EmbeddedFont,
          Aptos_MSFontService, Calibri, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <div><br class="x_ContentPasted1">
          </div>
        </div>
        <div class="x_elementToProof x_ContentPasted1"
          style="font-family: Aptos, Aptos_EmbeddedFont,
          Aptos_MSFontService, Calibri, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          However, I need to switch to <b>MongoDB</b> as my database
          instead of MySQL. The issue is that it appears
          <b>auth_db</b> only supports <b>MySQL</b> and <b>PostgreSQL</b>
          databases. <b>My concern is that I must use MongoDB as the
            database for authorization in OpenSIPS. Is it possible to
            authorize users in OpenSIPS using MongoDB with the auth_db
            module, or should I consider an alternative module or
            approach?</b><br>
        </div>
        <div class="x_elementToProof x_ContentPasted1"
          style="font-family: Aptos, Aptos_EmbeddedFont,
          Aptos_MSFontService, Calibri, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <b><br>
          </b></div>
        <div class="x_elementToProof x_ContentPasted1"
          style="font-family: Aptos, Aptos_EmbeddedFont,
          Aptos_MSFontService, Calibri, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <span class="x_ContentPasted2"><b>Load auth_db module</b>
            <div style="font-weight:bold"><br class="x_ContentPasted2">
            </div>
            <blockquote itemscope=""
              itemtype="https://schemas.microsoft.com/QuotedText"
              style="border-left:3px solid rgb(200,200,200);
              border-top-color:rgb(200,200,200);
              border-right-color:rgb(200,200,200);
              border-bottom-color:rgb(200,200,200); padding-left:1ex;
              margin-left:0.8ex">
              <div class="x_ContentPasted2" style="font-weight:bold">loadmodule
                "auth_db.so"</div>
              <div class="x_ContentPasted2" style="font-weight:bold">modparam("auth_db",
                "db_url", "mysql://DB_USER:DB_PASSWORD@DB_HOST/DB_NAME")</div>
              <div class="x_ContentPasted2" style="font-weight:bold">modparam("auth_db",
                "load_credentials", "$avp(tmp_id)=id")</div>
              <div class="x_ContentPasted2" style="font-weight:bold">modparam("auth_db",
                "calculate_ha1", yes)</div>
              <div class="x_ContentPasted2" style="font-weight:bold">modparam("auth_db",
                "password_column", "password")</div>
            </blockquote>
            <div style="font-weight:bold"><br class="x_ContentPasted2">
            </div>
            <div class="x_ContentPasted2" style="font-weight:bold">check
              condition in routes.</div>
            <div style="font-weight:bold"><br class="x_ContentPasted2">
            </div>
          </span></div>
        <blockquote itemscope=""
          itemtype="https://schemas.microsoft.com/QuotedText"
          style="border-left:3px solid rgb(200,200,200);
          border-top-color:rgb(200,200,200);
          border-right-color:rgb(200,200,200);
          border-bottom-color:rgb(200,200,200); padding-left:1ex;
          margin-left:0.8ex">
          <div class="x_ContentPasted1" style="font-family: Aptos,
            Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica,
            sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
            <span class="x_ContentPasted2">
              <div class="x_ContentPasted2" style="font-weight:bold">if
                (!proxy_authorize("", "TABLE)_NAME")) {</div>
              <div class="x_ContentPasted2" style="font-weight:bold">      proxy_challenge("",
                "0");</div>
              <div class="x_ContentPasted2" style="font-weight:bold">      exit;</div>
              <b>}</b><br>
            </span></div>
          <div class="">
            <div style="font-family: Aptos, Aptos_EmbeddedFont,
              Aptos_MSFontService, Calibri, Helvetica, sans-serif;
              font-size: 12pt; color: rgb(0, 0, 0);">
              <br>
            </div>
          </div>
        </blockquote>
        <div class="x_elementToProof">
          <div id="x_Signature">
            <div>
              <div class="x_ContentPasted0" style="font-family: Calibri,
                Arial, Helvetica, sans-serif; font-size: 12pt; color:
                rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
                Best Regards,
                <div class="x_ContentPasted0">----</div>
                <div class="x_ContentPasted0">Harsh Patel</div>
                <div class="x_ContentPasted0">Team Lead.</div>
                <div class="x_ContentPasted0">Inextrix Technologies Pvt
                  Ltd (<a class="moz-txt-link-abbreviated" href="http://www.inextrix.com">www.inextrix.com</a>)</div>
                <div class="x_ContentPasted0">Mo: +1 315 898 1049 </div>
                <div class="x_ContentPasted0"><a class="moz-txt-link-freetext" href="https://www.inextrix.com/">https://www.inextrix.com/</a></div>
                <div><br class="x_ContentPasted0">
                </div>
                <div class="x_ContentPasted0"><span style="color:
                    rgb(23, 78, 134);">Disclaimer:</span></div>
                <span style="color: rgb(23, 78, 134);">The information
                  contained in this communication is confidential and
                  may be legally privileged. It is intended solely for
                  the use of the individual or entity to whom it is
                  addressed and others authorized to receive it. If you
                  are not the intended recipient you are hereby notified
                  that any disclosure, copying, distribution or taking
                  action in reliance on the contents of this information
                  is strictly prohibited and may be unlawful. Please
                  notify the sender immediately and destroy all copies
                  of this message and any attachments contained in it.</span><br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>