<div dir="ltr">Hey Bogdan,<div><br></div><div><br></div><div>I see that the module params define the spec variables now and I tried the following in my register method block</div><div><br></div><div> exec("php /etc/opensips/authenticate.php $var(input)","" , "$var(out)", "$var(err)", "$avp(env)");<br></div><div><br></div><div>this returns the text password </div><div><br></div><div><div> $var(username)= $fu;</div><div> $avp(password)= $var(out);</div></div><div><br></div><div><br></div><div><div> if (!pv_www_authorize(""))</div><div> {</div><div> xlog("new challenger $tU\n");</div><div> </div><div> # $var(rc) = www_authorize("", "subscriber");</div><div> $var(rc) = pv_www_authorize("");</div><div> xlog("Return code is $var(rc) \n");</div><div> </div><div> switch ( $var(rc) ) {</div><div> case 1 :</div><div> if (!save("location","f"))</div><div> sl_reply_error();</div><div> </div><div> exit;</div><div> # success</div><div> break;</div><div> case -1:</div><div> sl_send_reply("404","User not found");</div><div> exit;</div><div> break;</div><div> case -2:</div><div> sl_send_reply("403","Forbidden (Bad auth)");</div><div> exit;</div><div> break;</div><div> case -3:</div><div> www_challenge("", "0");</div><div> exit;</div><div> </div><div> default:</div><div> www_challenge("", "0");</div><div> exit;</div><div> </div><div> }</div><div> }</div></div><div><br></div><div><br></div><div>but I am not able to authenticate I keep getting -1 as if the user didn't exist although the script is returning a value and casting it to </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 21, 2017 at 1:59 PM, Tito Cumpen <span dir="ltr"><<a href="mailto:tito@xsvoce.com" target="_blank">tito@xsvoce.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Bogdan,<div><br></div><div><br></div><div>would I have to use the exec module to cast the into the username and password variables? Also I am not sure how the function expects those variables to be passed to it ? It is based on variables with these two names to be set prior to being called?</div><div><br></div><div><div>$var(username)="abc";</div><div>$avp(password)="xyz";</div></div><div><br></div><div>Thanks,</div><div>Tito</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 26, 2017 at 7:21 AM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<tt>Hi Tito,<br>
<br>
You can do that by fetching the password via an explicit DB query
from script and pushing it for auth check using
pv_www_authorize():<br>
<a class="m_3732967535493753989m_4140612310025486353moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/2.3.x/auth.html#idp5590848" target="_blank">http://www.opensips.org/html/d<wbr>ocs/modules/2.3.x/auth.html#id<wbr>p5590848</a><br>
<br>
Best regards,<br>
</tt>
<pre class="m_3732967535493753989m_4140612310025486353moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="m_3732967535493753989m_4140612310025486353moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<wbr>com</a>
OpenSIPS Bootcamp 2017, Huston, US
<a class="m_3732967535493753989m_4140612310025486353moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html" target="_blank">http://opensips.org/training/O<wbr>penSIPS_Bootcamp_2017.html</a>
</pre><div><div class="m_3732967535493753989h5">
<div class="m_3732967535493753989m_4140612310025486353moz-cite-prefix">On 05/25/2017 04:51 PM, Tito Cumpen
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="m_3732967535493753989h5">
<div dir="auto">
<div dir="auto">Group,</div>
<div dir="auto"><br>
</div>
Is it possible to use a rest api for auth_db? Meaning can
opensips authenticate a user based on a rest query against a
rest api? I thought about using db http by fronting the request
with a local http server but I don't see a way to pass a custom
headers to the query. This custom header would contain the auth
session token.
<div dir="auto"><br>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Thanks,</div>
<div dir="auto">Tito</div>
</div>
<br>
<fieldset class="m_3732967535493753989m_4140612310025486353mimeAttachmentHeader"></fieldset>
<br>
</div></div><pre>______________________________<wbr>_________________
Users mailing list
<a class="m_3732967535493753989m_4140612310025486353moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a class="m_3732967535493753989m_4140612310025486353moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>