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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

mechanism can alleviate this concern. Configuring a user authentication mechanism is<br />

described in “Specifying an Authentication Mechanism” on page 854.<br />

Verifying SSL Support<br />

For testing purposes, and to verify that SSL support has been correctly installed, load the default<br />

introduction page with a URL that connects to the port defined in the server deployment<br />

descriptor:<br />

https://localhost:8181/<br />

<strong>The</strong> https in this URL indicates that the browser should be using the SSL protocol. <strong>The</strong><br />

localhost in this example assumes that you are running the example on your local machine as<br />

part of the development process. <strong>The</strong> 8181 in this example is the secure port that was specified<br />

where the SSL connector was created. If you are using a different server or port, modify this<br />

value accordingly.<br />

<strong>The</strong> first time that you load this application, the New Site Certificate or Security Alert dialog box<br />

displays. Select Next to move through the series of dialog boxes, and select Finish when you<br />

reach the last dialog box. <strong>The</strong> certificates will display only the first time. When you accept the<br />

certificates, subsequent hits to this site assume that you still trust the content.<br />

Tips on Running SSL<br />

Establishing a Secure Connection Using SSL<br />

<strong>The</strong> SSL protocol is designed to be as efficient as securely possible. However, encryption and<br />

decryption are computationally expensive processes from a performance standpoint. It is not<br />

strictly necessary to run an entire web application over SSL, and it is customary for a developer<br />

to decide which pages require a secure connection and which do not. Pages that might require a<br />

secure connection include login pages, personal information pages, shopping cart checkouts, or<br />

any pages where credit card information could possibly be transmitted. Any page within an<br />

application can be requested over a secure socket by simply prefixing the address with https:<br />

instead of http:. Any pages that absolutely require a secure connection should check the<br />

protocol type associated with the page request and take the appropriate action if https is not<br />

specified.<br />

Using name-based virtual hosts on a secured connection can be problematic. This is a design<br />

limitation of the SSL protocol itself. <strong>The</strong> SSL handshake, where the client browser accepts the<br />

server certificate, must occur before the HTTP request is accessed. As a result, the request<br />

information containing the virtual host name cannot be determined before authentication, and<br />

it is therefore not possible to assign multiple certificates to a single IP address. If all virtual hosts<br />

on a single IP address need to authenticate against the same certificate, the addition of multiple<br />

virtual hosts should not interfere with normal SSL operations on the server. Be aware, however,<br />

that most client browsers will compare the server’s domain name against the domain name<br />

listed in the certificate, if any (this is applicable primarily to official, CA-signed certificates). If<br />

Chapter 28 • Introduction to Security in the <strong>Java</strong> <strong>EE</strong> Platform 785

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

Saved successfully!

Ooh no, something went wrong!