[OpenSIPS-Devel] Proxy authorization using MongoDB in Opensips

Liviu Chircu liviu at opensips.org
Wed Nov 15 10:07:38 UTC 2023


Hi Harsh,

Yes, it should be possible to achieve the authentication using MongoDB, 
with the help of the *db_cachedb* 
<https://opensips.org/docs/modules/3.4.x/db_cachedb.html>**adapter 
module, converting from NoSQL API -> SQL API.

Best regards,

On 01.11.2023 08:42, Harsh Patel via Devel wrote:
> I am currently using MySQL to proxy authorization using the *auth_db* 
> module. I am utilizing the *proxy_authorize* function to authorize 
> users in a MySQL table, and it is working perfectly.
>
> However, I need to switch to *MongoDB* as my database instead of 
> MySQL. The issue is that it appears *auth_db* only supports *MySQL* 
> and *PostgreSQL* databases. *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?*
> *
> *
> *Load auth_db module*
>
>     loadmodule "auth_db.so"
>     modparam("auth_db", "db_url",
>     "mysql://DB_USER:DB_PASSWORD@DB_HOST/DB_NAME")
>     modparam("auth_db", "load_credentials", "$avp(tmp_id)=id")
>     modparam("auth_db", "calculate_ha1", yes)
>     modparam("auth_db", "password_column", "password")
>
>
> check condition in routes.
>
>     if (!proxy_authorize("", "TABLE)_NAME")) {
>           proxy_challenge("", "0");
>           exit;
>     *}*
>
> Best Regards,
> ----
> Harsh Patel
> Team Lead.
> Inextrix Technologies Pvt Ltd (www.inextrix.com)
> Mo: +1 315 898 1049
> https://www.inextrix.com/
>
> Disclaimer:
> 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.
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel


-- 
Liviu Chircu
www.twitter.com/liviuchircu  |www.opensips-solutions.com
OpenSIPS eBootcamp, Nov 6-17 |www.opensips.org/training
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20231115/eba98eba/attachment.html>


More information about the Devel mailing list