<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hi Harsh,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Yes, it should be possible to achieve
      the authentication using MongoDB, with the help of the <a
        href="https://opensips.org/docs/modules/3.4.x/db_cachedb.html"><b>db_cachedb</b></a><b>
      </b>adapter module, converting from NoSQL API -> SQL API.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Best regards,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 01.11.2023 08:42, Harsh Patel via
      Devel wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:PNZPR01MB839475ABD060E352911B986B9AA7A@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 ContentPasted1">
        I am currently using MySQL to proxy authorization using the <b>auth_db</b>
        module. I am utilizing the
        <b>proxy_authorize</b> function to authorize users in a MySQL
        table, and it is working perfectly.
        <div><br class="ContentPasted1">
        </div>
      </div>
      <div
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"
        class="elementToProof ContentPasted1">
        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
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"
        class="elementToProof ContentPasted1">
        <b><br>
        </b></div>
      <div
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"
        class="elementToProof ContentPasted1">
        <span class="ContentPasted2"><b>Load auth_db module</b>
          <div style="font-weight: bold;"><br class="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="ContentPasted2" style="font-weight: bold;">loadmodule
              "auth_db.so"</div>
            <div class="ContentPasted2" style="font-weight: bold;">modparam("auth_db",
              "db_url", "mysql://DB_USER:DB_PASSWORD@DB_HOST/DB_NAME")</div>
            <div class="ContentPasted2" style="font-weight: bold;">modparam("auth_db",
              "load_credentials", "$avp(tmp_id)=id")</div>
            <div class="ContentPasted2" style="font-weight: bold;">modparam("auth_db",
              "calculate_ha1", yes)</div>
            <div class="ContentPasted2" style="font-weight: bold;">modparam("auth_db",
              "password_column", "password")</div>
          </blockquote>
          <div style="font-weight: bold;"><br class="ContentPasted2">
          </div>
          <div class="ContentPasted2" style="font-weight: bold;">check
            condition in routes.</div>
          <div style="font-weight: bold;"><br class="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
style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"
          class="ContentPasted1">
          <span class="ContentPasted2">
            <div class="ContentPasted2" style="font-weight: bold;">if
              (!proxy_authorize("", "TABLE)_NAME")) {</div>
            <div class="ContentPasted2" style="font-weight: bold;">      proxy_challenge("",
              "0");</div>
            <div class="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="elementToProof">
        <div id="Signature">
          <div>
            <div
style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"
              class="ContentPasted0">
              Best Regards,
              <div class="ContentPasted0">----</div>
              <div class="ContentPasted0">Harsh Patel</div>
              <div class="ContentPasted0">Team Lead.</div>
              <div class="ContentPasted0">Inextrix Technologies Pvt Ltd
                (<a class="moz-txt-link-abbreviated" href="http://www.inextrix.com">www.inextrix.com</a>)</div>
              <div class="ContentPasted0">Mo: +1 315 898 1049 </div>
              <div class="ContentPasted0"><a class="moz-txt-link-freetext" href="https://www.inextrix.com/">https://www.inextrix.com/</a></div>
              <div><br class="ContentPasted0">
              </div>
              <div class="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>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Devel@lists.opensips.org">Devel@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a>
</pre>
    </blockquote>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Liviu Chircu
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/liviuchircu">www.twitter.com/liviuchircu</a> | <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a>
OpenSIPS eBootcamp, Nov 6-17 | <a class="moz-txt-link-abbreviated" href="http://www.opensips.org/training">www.opensips.org/training</a></pre>
  </body>
</html>