[OpenSIPS-Users] Fw: Proxy authorization using MongoDB in Opensips
Bogdan-Andrei Iancu
bogdan at opensips.org
Wed Nov 1 11:12:18 UTC 2023
Hi,
Natively, the auth_db supports only SQL databases.
Options you have:
1) try simulating an SQL DB from a noSQL one, by using the db_cachedb
module [1]
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.
[1] https://opensips.org/html/docs/modules/3.4.x/db_cachedb.html
[2]
https://opensips.org/html/docs/modules/3.4.x/auth.html#func_pv_proxy_authorize
[3]
https://www.opensips.org/Documentation/Script-CoreFunctions-3-4#cache_fetch
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
https://www.siphub.com
On 11/1/23 9:07 AM, Harsh Patel via Users 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.
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20231101/a511654c/attachment-0001.html>
More information about the Users
mailing list