Configure Security
Configure Security
Watch a demonstration of the current section
- In the Project Explorer view, expand example > src > main > webapp > WEB-INF
- Open red5-web.xml
-
Below the web-handler bean add the following security bean
<bean id="authDataValidator" class="com.red5pro.server.plugin.simpleauth.datasource.impl.Red5ProFileAuthenticationValidator" init-method="initialize"> <property name="context" ref="web.context" /> <property name="dataSource" value="/WEB-INF/simple-auth-plugin.credentials" /> </bean> <bean id="simpleAuthSecurity" class="com.red5pro.server.plugin.simpleauth.Configuration" > <property name="active" value="true" /> <property name="rtmp" value="true" /> <property name="rtsp" value="true" /> <property name="rtc" value="true" /> <property name="rtmpAllowQueryParamsEnabled" value="true" /> <property name="allowedRtmpAgents" value="*" /> </bean>
- The authDataValidator bean above defines a custom credentials file that should be visibile from _$RED5HOME/webapps/example/WEB-INF. Let’s set that up
- Copy the example credentials file located in _$RED5_PROHOME/conf/simple-auth-plugin.credentials
- Switch back to Eclipse and expand example > src > main > webapp > WEB-INF
- Paste the copied file in the WEB-INF folder
-
Add authentication credentials
- Open the simple-auth-plugin.credentials file
- Place your cursor at the bottom on a blank line
-
Enter testuser testpass as the contents of the line. Usernames and Passwords are separated by a blank space. You can add more credentials with each Username/Password pair on a new blank line like so:
#Simple auth credentials file #[ Add username and password as key-value pair separated by a space (one per line) ] #Example: testuser testpass #Wed Feb 22 18:22:07 IST 2017 testuser testpass
- Save the file