<div dir="ltr"><div>Hi All,</div><div><br></div><div>I was able to get it working and VLC now asks me for a username and password when accessing the stream. Awesome !!<br></div><div><br></div><div>Not sure what is the difference between <b>GST_RTSP_PERM_MEDIA_FACTORY_ACCESS</b>  and 

<b>GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT</b>, however VLC doesn't work without both.<br><b></b></div><div><b><br></b></div><div><b><br></b></div><div><b><br></b></div><div>The code for the permissions section is as follows, let me know if you see anything wrong. Thanks !<br></div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace,"Droid Sans Fallback";font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(78,201,176)">GstRTSPMediaFactory</span><span style="color:rgb(212,212,212)"> *</span><span style="color:rgb(156,220,254)">gst_rtsp_factory_var</span><span style="color:rgb(212,212,212)">;</span></div><div><span style="color:rgb(78,201,176)">GstRTSPAuth</span><span style="color:rgb(212,212,212)"> *</span><span style="color:rgb(156,220,254)">gst_rtsp_auth_var</span><span style="color:rgb(212,212,212)">;</span></div><div><span style="color:rgb(78,201,176)">GstRTSPMountPoints</span><span style="color:rgb(212,212,212)"> *</span><span style="color:rgb(156,220,254)">gst_rtsp_mounts_var</span><span style="color:rgb(212,212,212)">;</span></div></div></div><div>//setup authentication</div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace,"Droid Sans Fallback";font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(156,220,254)">gst_rtsp_auth_var</span><span style="color:rgb(212,212,212)"> = </span><span style="color:rgb(220,220,170)">gst_rtsp_auth_new</span><span style="color:rgb(212,212,212)">();</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(220,220,170)">gst_rtsp_auth_set_supported_methods</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">gst_rtsp_auth_var</span><span style="color:rgb(212,212,212)">,</span><span style="color:rgb(79,193,255)">GST_RTSP_AUTH_DIGEST</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(220,220,170)">gst_rtsp_server_set_auth</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">p_rtsp_server</span><span style="color:rgb(212,212,212)">,</span><span style="color:rgb(156,220,254)">gst_rtsp_auth_var</span><span style="color:rgb(212,212,212)">);</span></div></div></div><div><b></b></div><div><br></div><div>//add user</div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace,"Droid Sans Fallback";font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(86,156,214)">void</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(220,220,170)">add_rtsp_user</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(78,201,176)">string</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(78,201,176)">string</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">password</span><span style="color:rgb(212,212,212)">){</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(78,201,176)">debug_log</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">log</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">"rtsp_thread"</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(206,145,120)">"rtsp_users"</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(156,220,254)">log</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">msg</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">"Adding User "</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(220,220,170)">+</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">);</span></div><br><div><span style="color:rgb(106,153,85)">    //remove the role if it already exists</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(220,220,170)">remove_rtsp_user</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">);</span></div><br><div><span style="color:rgb(106,153,85)">    //add the role with factory and construct access;</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(220,220,170)">gst_rtsp_media_factory_add_role</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">gst_rtsp_factory_var</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">c_str</span><span style="color:rgb(212,212,212)">(), </span><span style="color:rgb(86,156,214)">GST_RTSP_PERM_MEDIA_FACTORY_ACCESS</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(86,156,214)">G_TYPE_BOOLEAN</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(86,156,214)">TRUE</span><span style="color:rgb(212,212,212)">,</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(86,156,214)">GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(86,156,214)">G_TYPE_BOOLEAN</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(86,156,214)">TRUE</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(86,156,214)">NULL</span><span style="color:rgb(212,212,212)">);</span></div><br><div><span style="color:rgb(106,153,85)">    //make user token</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(78,201,176)">GstRTSPToken</span><span style="color:rgb(212,212,212)">* </span><span style="color:rgb(156,220,254)">token</span><span style="color:rgb(212,212,212)"> = </span><span style="color:rgb(220,220,170)">gst_rtsp_token_new</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(86,156,214)">GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(86,156,214)">G_TYPE_STRING</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">c_str</span><span style="color:rgb(212,212,212)">(), </span><span style="color:rgb(86,156,214)">NULL</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(220,220,170)">gst_rtsp_auth_add_digest</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">gst_rtsp_auth_var</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">c_str</span><span style="color:rgb(212,212,212)">(), </span><span style="color:rgb(156,220,254)">password</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">c_str</span><span style="color:rgb(212,212,212)">(), </span><span style="color:rgb(156,220,254)">token</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(220,220,170)">gst_rtsp_token_unref</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">token</span><span style="color:rgb(212,212,212)">);</span></div><br><div><span style="color:rgb(212,212,212)">}</span></div></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><div class="gmail_attr">//remove user</div><div class="gmail_attr"><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace,"Droid Sans Fallback";font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(86,156,214)">void</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(220,220,170)">remove_rtsp_user</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(78,201,176)">string</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">){</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(78,201,176)">debug_log</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">log</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">"rtsp_thread"</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(206,145,120)">"rtsp_users"</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(156,220,254)">log</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">msg</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">"Removing Users"</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(78,201,176)">GstRTSPPermissions</span><span style="color:rgb(212,212,212)">* </span><span style="color:rgb(156,220,254)">perms</span><span style="color:rgb(212,212,212)"> = </span><span style="color:rgb(220,220,170)">gst_rtsp_media_factory_get_permissions</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">gst_rtsp_factory_var</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">perms</span><span style="color:rgb(212,212,212)">){</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(156,220,254)">log</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">msg</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">"Permissions Found"</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(220,220,170)">gst_rtsp_auth_remove_digest</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">gst_rtsp_auth_var</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">c_str</span><span style="color:rgb(212,212,212)">());</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(220,220,170)">gst_rtsp_permissions_remove_role</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(156,220,254)">perms</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(156,220,254)">user_name</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">c_str</span><span style="color:rgb(212,212,212)">());</span></div><br><div><span style="color:rgb(212,212,212)">    }</span><span style="color:rgb(197,134,192)">else</span><span style="color:rgb(212,212,212)">{</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(156,220,254)">log</span><span style="color:rgb(212,212,212)">.</span><span style="color:rgb(220,220,170)">msg</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(206,145,120)">"No Permissions Yet. Nothing to remove."</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">    }</span></div><br><div><span style="color:rgb(212,212,212)">}</span></div></div></div><div dir="ltr" class="gmail_attr"><br></div><div dir="ltr" class="gmail_attr">On Tue, Aug 31, 2021 at 10:19 AM Dwight Kulkarni <<a href="mailto:dwight@realtime-7.com">dwight@realtime-7.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Michael and everyone,<div><br></div><div>Thank you for that info. When reviewing the referenced code snippet, I had two questions</div><div><br></div><div>1) <b>gst_rtsp_media_factory_add_role</b> (this->factory, user_name,</div>      GST_RTSP_PERM_MEDIA_FACTORY_ACCESS, G_TYPE_BOOLEAN, TRUE,<br>      GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT, G_TYPE_BOOLEAN, TRUE, NULL);<br><br>What is the difference between: <b>GST_RTSP_PERM_MEDIA_FACTORY_ACCESS</b>  and 

<b>GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT</b><br><br>When I checked the docs, both said FALSE will return a 404 error when trying to access the media. In the code, it appears to setup some users only with MEDIA_FACTORY_ACCESS and not MEDIA_FACTORY_CONSTRUCT.<div><br></div><div><br>2)  After the roles are added if the user access changes. For example a user is removed or their password updated, I could not find a way to remove the user. </div><div><br></div><div>For example the code calls two functions to create the user and set the password, I wanted the opposite to undo this. </div><div><br></div><div>//set the user<br></div><div><b>gst_rtsp_media_factory_add_role( ... )</b>  -> 

<b>gst_rtsp_media_factory_remove_role( .. )</b></div><div><b>gst_rtsp_auth_add_digest  ( ... ) </b>->  

<b>gst_rtsp_auth_remove_digest ( .. )</b><br><br><br>Thank you !<br><br><br><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 30, 2021 at 6:33 PM Michael Gruner <<a href="mailto:michael.gruner@ridgerun.com" target="_blank">michael.gruner@ridgerun.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hello Dwight<div><br></div><div>Here's a working example from the server repo itself:</div><div><br></div><div><a href="https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-auth-digest.c" target="_blank">https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-auth-digest.c</a></div><div><br></div><div>Michael</div><div><a href="http://www.ridgerun.com" target="_blank">www.ridgerun.com</a></div><div><br><div><br><blockquote type="cite"><div>On 30 Aug 2021, at 14:09, Dwight Kulkarni via gstreamer-devel <<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>> wrote:</div><br><div><div dir="ltr">Hi All,<div><br></div><div>I have got Gstreamer working with my C++ program and I am using the RTSP server in Gstreamer to work with my pipeline.</div><div><br></div><div>When I visit the network address: rtsp://<a href="http://192.168.0.20/myserviceurl" target="_blank">192.168.0.20/myserviceurl</a></div><div><br></div><div>It is showing the network stream correctly in VLC Client.</div><div><br></div><div>However, now I want to turn on digest authentication so that we can secure the stream, and it can only be seen when the username and password is supplied in VLC like so:</div><div><br></div><div>rtsp://<a href="http://username:password@192.168.0.20/myserviceurl" target="_blank">username:password@192.168.0.20/myserviceurl</a></div><div><br></div><div>If my program has a list of users and passwords, how can I register them with the Gstreamer RTSP server and require digest authentication?<br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><div><br></div><div>Dwight Kulkarni      </div></div></div></div></div></div></div></div></div>
</div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><div><br></div><div>Dwight Kulkarni                </div><div><br></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="font-size:12.8px">Sincerely,</span><div><br></div><div>Dwight Kulkarni                </div><br></div></div></div></div></div></div></div>