Skip to content

JWT REST API Filter for Web Management Panel REST Services

cemklc edited this page Sep 5, 2021 · 12 revisions

Some REST commands which are not Application-specific, such as creating and deleting an app, creating a new user, etc, require an Authentication Filter by logging in to the Web Management Panel. This creates some limitations for people who don't want to use the web panel every time and want access to all of the REST commands. We have created a new JWT filter for those commands which will make you have access to all REST commands without logging on to the management panel.

To enable Jwt Filter for web management panel REST commands, first, change the file at

ant-media-server-directory/webapps/root/WEB-INF/web.xml

Find and replace the Authentication Filter lines

<filter>
    	<filter-name>AuthenticationFilter</filter-name>
   		<filter-class>io.antmedia.console.rest.AuthenticationFilter</filter-class>
  	</filter>

  	<filter-mapping>
  		<filter-name>AuthenticationFilter</filter-name>
		<url-pattern>/rest/*</url-pattern>
  	</filter-mapping>

with the lines below

<filter>
    	<filter-name>JWTServerFilter</filter-name>
   		<filter-class>io.antmedia.console.rest.JWTServerFilter</filter-class>
  	</filter>

  	<filter-mapping>
  		<filter-name>JWTServerFilter</filter-name>
		<url-pattern>/rest/*</url-pattern>
  	</filter-mapping>

Be aware that this disables Authentication filter and the management web panel will not be accessible from the browser.

Second, find and change the file

ant-media-server-directory/conf/red5.properties

The default lines are

server.jwtServerControlEnabled=false
server.jwtServerSecretKey=

Change the lines as

server.jwtServerControlEnabled=true
server.jwtServerSecretKey= your-secret-key-at-least-32-character

Then, you can use all management panel REST commands using a header same as the normal REST API commands as in the link below. More information about JWT Filter can be found here https://github.com/ant-media/Ant-Media-Server/wiki/JWT-REST-API-Filter

User Guide

Reference

Troubleshooting

Draft

Proposals

Clone this wiki locally