[OpenSIPS-Users] Need help in memory caching in opensips 3.0 .

Sasmita Panda spanda at 3clogic.com
Wed Jun 3 07:20:23 EST 2020


I have changed my config like below .
        if(cache_fetch("local","passwd_$tu",$avp(password))) {
                $avp(username) = $tU;

                  xlog("SCRIPT: stored password is $avp(username)
 $avp(password)\n");
                if (!pv_proxy_authorize("")){
                        proxy_challenge("", "1");
                        exit;
                };

        } else {

                if (!proxy_authorize("", "subscriber")) {
                        # authentication failed -> do challenge
                        proxy_challenge("","1");
                        exit;
                };

                xlog("SCRIPT: storing password <$avp(password)>\n");

                cache_store("local","passwd_$tu","$avp(password)",1200);
        }

 Now its giving "Proxy authentication required" response .


*Thanks & Regards*
*Sasmita Panda*
*Senior Network Testing and Software Engineer*
*3CLogic , ph:07827611765*


On Wed, Jun 3, 2020 at 12:24 AM Tito Cumpen <tito at xsvoce.com> wrote:

> Sasmita,
>
>
> Try using
>
>
>   proxy_challenge("", "1");
>
>
> instead of
>                         www_challenge("", "1");
>
>
>
>
>
> On Tue, Jun 2, 2020 at 12:36 AM Sasmita Panda <spanda at 3clogic.com> wrote:
>
>> Can  anyone help me on the above issue please ? Still I am stuck on this .
>>
>>
>> *Thanks & Regards*
>> *Sasmita Panda*
>> *Senior Network Testing and Software Engineer*
>> *3CLogic , ph:07827611765*
>>
>>
>> On Fri, May 29, 2020 at 6:05 PM Sasmita Panda <spanda at 3clogic.com> wrote:
>>
>>> Hi ,
>>>
>>> I am trying to do memory caching for authentication .  Followed the
>>> below link.
>>> https://www.opensips.org/Documentation/Tutorials-MemoryCaching
>>>
>>> my DB looks like below .
>>> | id | username | domain               | password | email_address | ha1
>>> | ha1b | rpid |
>>>
>>> +----+----------+--------------------------------------------+----------+---------------+-----+------+------+
>>> |  1 | 7878     | fs-reg.i3clogic.com | som123 |               |     |
>>>      | NULL |
>>>
>>> loadmodule "cachedb_local.so"
>>> #loading auth module
>>> loadmodule "auth.so"
>>> loadmodule "auth_db.so"
>>>
>>> modparam("auth_db", "db_url", "mysql://root:cccl0g1c@localhost
>>> /opensips")
>>> modparam("auth_db", "calculate_ha1", yes)
>>> modparam("auth_db", "user_column", "username")
>>> #modparam("auth_db", "use_domain", 1)
>>> modparam("auth_db", "domain_column", "domain")
>>> modparam("auth_db", "password_column", "password")
>>> modparam("auth_db", "load_credentials", "$avp(55)=password")
>>>
>>> modparam("auth","username_spec","$avp(54)")
>>> modparam("auth","password_spec","$avp(55)")
>>>
>>>  if(cache_fetch("local","passwd_$tu",$avp(55))) {
>>>                 $avp(54) = $tU;
>>>                 if (!pv_www_authorize("")) {
>>>                         # authentication failed -> do challenge
>>>                         www_challenge("", "1");
>>>                         exit;
>>>                 };
>>>         } else {
>>>                 if (!www_authorize("", "subscriber")) {
>>>                         # authentication failed -> do challenge
>>>                         www_challenge("", "1");
>>>                         exit;
>>>                 };
>>>                 # after DB authentication, the password is available
>>>                 cache_store("local","passwd_$tu","$avp(55)",1200);
>>>         }
>>>
>>>
>>> This thing I have done . While doing DB authentication its working , but
>>> which doing through memory caching its giving error "Incorrect Password" .
>>> Whats wrong I  am doing . please help me .
>>>
>>> *Thanks & Regards*
>>> *Sasmita Panda*
>>> *Senior Network Testing and Software Engineer*
>>> *3CLogic , ph:07827611765*
>>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
> _______________________________________________
> 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/20200603/55d11ea8/attachment-0001.html>


More information about the Users mailing list