Configuring Credentials
The simple-authentication module stores its credentials in the RED5_HOME/conf/simple-auth-plugin.credentials
file. Each credential is stored as a property-value pair and all the credentials are loaded into memory when the server starts. If your scope configuration overrides this to use a different credentials file, the process to edit credentials would be the same as shown below.
A credential (username & password) pair is stored in a new line with a single space separating the username and the password.
Sample simple-auth-plugin.credentials file
Add a new entry by adding the new credentials in a new line.
Remove credentials by removing the line.
NOTE: Red5pro server must be restarted for changes to take effect.
Client Authentication
RTMP, RTSP, and WebRTC clients must provide connection parameters when attempting to establish a connection with the server. The plugin will extract two parameters (username and password) and try to match them against the username-password pairs in the properties file.
Following are some snippets, explaining how authentication can be achieved for different client types.
Authenticating RTMP Clients
RTMP clients must pass authentication parameters (username & password) using the connection arguments in [NetConnection.connect](https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetConnection.html#connect())
Example A
Username and password should be the first two parameters in the arguments array being sent to Red5 Pro.
With the simpleauth.default.rtmp.queryparams=true
in the plugin configuration file or using the rtmpAllowQueryParamsEnabled
property of configuration bean set to true
, RTMP clients can also pass parameters in the query string.
Example B
Authenticating RTSP Clients
RTSP clients (Android & iOS) must pass authentication parameters (username & password) using the R5Configuration
object in the SDK.
Android Example
iOS Example
Authenticating WebRTC Clients
WebRTC clients (Using Red5 Pro HTML5 SDK) must pass authentication parameters using the connectionParams
property of the baseConfiguration
object.
Example:
Special Note (for Application Developers)
To use this plugin properly with your application it is important to follow the application lifecycle. The plugin intercepts the invocation of the method – public boolean appConnect(IConnection conn, Object[] params)
. Your application’s main class (MultithreadedApplicationAdapter) must make a call to the super
method as shown in the snippet below.
A
true
orfalse
returned directly will drop the application from the plugin’s call chain.