Tomcat Security-Constraint
|
|
|
Tomcat Security Constraint tutorial
Security constraint
Security Constraints are least understood by developers, even though they are critical for the security of you J2EE Web applications. Specifying a combination of URL patterns, HTTP methods, roles and transport constraints can be daunting to a programmer or administrator. It is important to realize that any combination that was intended to be secure but was not specified via security constraints, will mean that the web container will allow those requests.
Security Constraints
consist of Web Resource Collections (URL patterns, HTTP methods),
Authorization Constraint
(role names) and User Data Constraints (whether the web request needs to be received over a protected transport such as TLS)
Unchecked access
We would like to define a set of web resources that will have public or unchecked access. We will achieve this by omitting the authorization constrainsts ( auth-constraint element).
Restricted access
Tomcat Authentication
A web container can authenticate a web client or user using either
- HTTP BASIC;
- HTTP DIGEST;
- HTTPS CLIENT;
- or FORM based authentication schemes.
e.g. : We would like to utilize the browser authentication mechanism, HTTP BASIC as defined in the HTTP 1.0 specification. The login-config element in web.xml would look like the following: