Authorization Step 1: defining roles

The most common form of authorization in servlets is for the container to determine whether a specific servlet—and the invoking HTTP request method—can be called by a user who has been assigned a certain security “role”. So the first step is to map the roles in the vendor-specific “users” file to roles established in the Deployment Descriptor.

image with no caption

VENDOR-SPECIFIC:

The <role> element in tomcat-users.xml

image with no caption

The deployer creates <role-name> elements in the DD, so that the Container can map roles to users.

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.