From the course: WebSocket Programming with Java EE

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

WebSocket security

WebSocket security

From the course: WebSocket Programming with Java EE

Start my 1-month free trial

WebSocket security

- [Instructor] We're going to implement basic authentication so that a username and a password must be entered in order to access the client application. We need to amend two files the deployment descriptor which is the web.xml file and the pom.xml file. Okay, so you need to open the deployment descriptor. This is located in the web app directory under WEB-INF. I already have it open on my screen. Also, go to consensus configure between the security constraint elements. So let's add these to start. So we're just going to enter security constraints like so. Now within these elements we define the web resource. This is where we specify the pattern of the url to be protected and the http method. The url path will be the path to the chat url. So in this case it will be just /rooms/*. Now the * matches any path after the room's route. This means that a request to any room will be caught by this template and security constraints will be applied. So let's type that in. So for the web…

Contents