Skip to main content
January 11, 2010
Question

Auth Plugin

  • January 11, 2010
  • 1 reply
  • 708 views

Good morning,

I want to know how to detect the call of a function in the plugin Auth.
Is there something like getNotifyAction?
The idea is to read the username and password of the connection.

Serverscript already did but I need to do it with a SQL database so I use the Plugin.
Thank you very much for your help

var connection: NetConnection = new Conecction ();
connection.connect ( "rtmp: / / 127.0.0.1", "username", "password");

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    January 11, 2010

    Hi,

         The authorization plugin does not intercept the calls from client to server. The authorization plugin can intercept connection and stream events and authorize the properties appropriate to these events. There is a addNotifyAction() method that can all a server side method.

    I am not clear on your workflow. Can you please provide more details if possible so it will be easy for me to understand.

    Regards

           Viraj

    January 12, 2010

    hi vgokhale

    Thanks for responding.
    My intention is to make a user control via password using a sql database. That's realized with SharedObject but the problem is inefficiency. How can FMS connect with a SQL database for user control?

    PS:I use FMS 3.5

    Participating Frequently
    January 13, 2010

    Hi,

           As per your requirement you want to connect to SQL database for authentication and then authenticate the username and password the user has passed against entries in the SQL database and then if the username and password are correct allow the connection else reject the connection.

    In this case I would suggest you to use the access plugin insted of authorization plugin. The access plugin intercepts the connect event issued by each client to an application defined in FMS. So what you need to do is:

    1. Pass the user name and password as a query string in the rtmp url from flash application. Something like nc.connect("rtmp://localhost:1935/vod?user=someuser&password=somepassword");

    2. In the access plugin's "case IFCAccess::CONNECT" event(adaptor.cpp) get the value of s-uri field and tokenize the string to fetch the username and password.

    3. Using a ODBC bridge develop a C++ module that can connect to your SQL database and validate the username and password. If success this module should return you true else should return you false.

    4. Strip off the query parameters from s-uri field and rewrite the value using the setField() API provided by access plugin.

    5. Check if the C++ module to check username and password returned true or false. If true is returned then call pAccess->accept() else call pAccess->reject("username/password is invalid")

    So if the authentication with SQL database succeeds the access plugin would allow the connection. If authentication fails then the connection would be rejected and client will get the description as the string value passed in reject() method.

    The approch mentioned above is only to provide user authentication mechanism before the user establishes the connection. If you want the authentication to be performed when client publishes a stream or plays a stream then you can use the authorization plugin and authorize respective events to perform user authentication.

    Thanks

          Viraj