10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

When you try to access a web resource that is constrained by a security-constraint element,<br />

the web container activates the authentication mechanism that has been configured for that<br />

resource. To specify an authentication method, place the element between<br />

elements in the deployment descriptor, like this:<br />

<br />

BASIC<br />

<br />

An example of a deployment descriptor that constrains all web resources for this application (in<br />

italics below) and requires HTTP basic authentication when you try to access that resource (in<br />

bold below) is shown here:<br />

<br />

<br />

basicauth<br />

<br />

index<br />

index<br />

/index.jsp<br />

<br />

<br />

loginUser<br />

<br />

<br />

SecurityConstraint1<br />

<br />

WRCollection<br />

/*<br />

<br />

<br />

loginUser<br />

<br />

<br />

<br />

BASIC<br />

<br />

<br />

Defining Security Requirements forWeb Applications<br />

Before you can authenticate a user, you must have a database of user names, passwords, and<br />

roles configured on your web or application server. For information on setting up the user<br />

database, refer to “Managing Users and Groups on the Application Server” on page 779 and the<br />

<strong>Oracle</strong> GlassFish Server 2.1.2 Administration Guide.<br />

Chapter 30 • SecuringWeb Applications 855

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!