/

Configure Security


Configure Security

Watch a demonstration of the current section
  1. In the Project Explorer view, expand example > src > main > webapp > WEB-INF
  2. Open red5-web.xml
  3. 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>
  4. The authDataValidator bean above defines a custom credentials file that should be visibile from $RED5HOME/webapps/example/WEB-INF_. Let's set that up

    1. Copy the example credentials file located in $RED5PROHOME/conf/simple-auth-plugin.credentials
    2. Switch back to Eclipse and expand example > src > main > webapp > WEB-INF
    3. Paste the copied file in the WEB-INF folder
  5. Add authentication credentials

    1. Open the simple-auth-plugin.credentials file
    2. Place your cursor at the bottom on a blank line
    3. 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
  6. Save the file