Wowza Community

User Authentication

I too would like to authenticate users from a MySQL database in addition to adding an entry to a table when a video is done recording. Thanks for posting your example code. Question. How are the user credentials passed to WMS? Can they be passed from a flash object? PHP? Are there some docs I can study to get an idea of the communication between Flash and WMS?

Hello, i have used these examples to port an existing FMS system and setup server-side authetication on Wowza however i get a java.lang.reflect.InvocationTargetException error and the connection is always accepted. There is no further information that i can get out of this to help me debug. Do you have any advice on this?

thanks

Hash

Ok thanks for the info. Instead of actually sending a username and password i wanted to modify the function to receive a single session_id token.

nc.connect(serverUrl,_root.token)

and in the module

...
static public void onConnect(IClient client, RequestFunction function, AMFDataList params) 
	{
	String token = getParamString(params, PARAM1);
	//String password = getParamString(params, PARAM2);
...

The idea being that the login is done independently and a live session table is looked up to make sure that only active and authorised sessions can access the streams.

Can you see where the error might be?

thanks

Hash

Hi i’ve worked through this issue but now i have a strange problem.

Regardless of whether the sql result leads to an acceptConnection or rejectConnection (which i added as an else condition), the flash client is still able to stream. How do i ensure that the client cannot stream if the connection is not authorised?

Log as follows:

INFO session connect-pending 125.54.xxx.xxx -
INFO server comment - Reject Connection (I added this)
INFO server comment - onConnect: 86830892
INFO server comment - onConnect: false
INFO session connect 125.54.xxx.xxx -
INFO server comment - onConnectAccept: 86830892
INFO stream create - -

AutoAccept is set to false on server and application.

thanks

Hash

Hi i have tested using the method described above and it still accepts the connection. Note that i have Wowza running on port 1936 for testing.

Log as follows:

INFO application app-start _definst_ -
INFO session connect-pending 125.54.xxx.xxx -
INFO server comment - onConnect: false
INFO session connect 125.54.xxx.xxx -
INFO server comment - onConnectAccept: 581738787

and here is the code in the flash client

nc.onStatus = function(info) {
	trace("Level: "+info.level+" Code: "+info.code);
	if (info.code == "NetConnection.Connect.Success") {
		trace("--- connected to: " + this.uri);
                          //do something
	} else if (info.code == "NetConnection.Connect.Rejected") {
		//do something
	}
};

Please advise on what might be going wrong.

Thanks

Hash

Yes the code is being executed because the log indicates so. Unfortunately it failed again:

INFO session connect-pending 125.54.xxx.xxx -
INFO server comment - REJECT
INFO server comment - onConnect: false
INFO session connect 125.54.xxx.xxx -

and the Flash client info.code response is as before

Level: status Code: NetConnection.Connect.Success

Note also that we have to have FMS running on port 1935 at the moment but i can’t imagine how that could interfere.

thanks

Hash

Hi you are absolutely right, i was calling the bwcheck module after the authentication module. I reordered the module list and the connection is being rejected as expected.

Thanks for the support.

It looks like the problem is missing user table:

ERROR server comment - sqlexecuteException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: Table ‘test.users’ doesn’t exist

Richard

Send user name and password to Wowza when you connect. Assuming you have text boxes named username and pwd, it would look something like this:

var nc:NetConnection;
nc.connect("rtmp://localhost/simplevideostreaming", username.text, pwd.text)

Richard

Can you post some of the code you are working on? Show the server-side and how you are invoking that on the client.

Those logs and traces are good on client and server, you are connected.

ObjectEncoding AMF0 is unnecessary, but no problem is indicated.

Hello.

Can somebody of you upload a sample of a flash file to connect to wowza using the mysql module published here ?

Thanks.

Lester

Send user name and password to Wowza when you connect. Assuming you have text boxes named username and pwd, it would look something like this:

var nc:NetConnection;
nc.connect("rtmp://localhost/simplevideostreaming", username.text, pwd.text)

Richard