Tuesday, September 6, 2016

Protected Stream publish with username and password programmatically

So I come across an unique problem with publishing RTMP stream to Wowza Media Streaming Server, and the built-in security feature does not fit my need to protect the publish stream programmatically. Luckily, this link from Wowza showed me how to achieve this on Wowza Streaming Engine 4.0 in detail.

1. Download wse-plugin-onconnectauthenticate.zip.

2. Extract the contents from the downloaded (zipped) package, and then copy the lib/wse-plugin-onconnectauthenticate.jar file from the package to the lib folder in your Wowza Streaming Engine installation ([install-dir]/lib).

3. Restart Wowza Streaming Engine.



Configuration

To enable this module, add the following module definition to your application. See Configure modules for details.


ModuleOnConnectAuthenticate Authenticates Flash connections. com.wowza.wms.plugin.OnConnectAuthenticate


After enabling the module, you can adjust the default settings by adding the following properties to your application. See Configure properties for details.

/Root/Application rtmpAuthenticateFile String ${com.wowza.wms.context.VHostConfigHome}/conf/connect.password Path to password file that is used to authenticate connections. (default:${com.wowza.wms.context.VHostConfigHome}/conf/connect.password)

/Root/Application usernamePasswordProviderClass String com.example.MyCustomClass Fully qualified class name of a custom class that is used to resolve passwords. (default: not set)

/Root/Application AllowEncoder String FM, Wirecast Comma-separated list of encoder Flash Version strings that are allowed to connect without authentication. (default: not set)



This module uses its own password file named connect.password. By default, this file should be in the [install-dir]/conf folder. The name and location of this file can be configured using the rtmpAuthenticateFile property.

To configure the location where this file is stored:

Create a text file named connect.password in the [install-dir]/conf folder.

Edit [install-dir]/conf/connect.password and add at least one line with a username and password pair (separate each username and password with a space):
user1 pass1
user2 pass2
Save and close the file.


Flash client configuration

To modify the NetConnection.connect statement in the Flash client to pass a username and password, use the following example:
var username:String = "user1";
var password = "pass1";
netconnection.connect("rtmp://[wowza-ip-address]/yourApp",username,password);



Original Post URL :
https://www.wowza.com/forums/content.php?160-How-to-do-file-based-RTMP-authentication-with-NetConnection-connect-(ModuleOnConnectAuthenticate)

No comments:

Post a Comment