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.

■ You can define a transport guarantee for an application in its deployment descriptor. Use<br />

this method to run over an SSL-protected session and ensure that all message content is<br />

protected for confidentiality or integrity. <strong>The</strong> options for transport guarantees are discussed<br />

in “Specifying a Secure Connection” on page 853.<br />

When running over an SSL-protected session, the server and client can authenticate one<br />

another and negotiate an encryption algorithm and cryptographic keys before the<br />

application protocol transmits or receives its first byte of data.<br />

SSL technology allows web browsers and web servers to communicate over a secure<br />

connection. In this secure connection, the data is encrypted before being sent, and then is<br />

decrypted upon receipt and before processing. Both the browser and the server encrypt all<br />

traffic before sending any data. For more information, see “Establishing a Secure<br />

Connection Using SSL” on page 783.<br />

Digital certificates are necessary when running HTTP over SSL (HTTPS). <strong>The</strong> HTTPS<br />

service of most web servers will not run unless a digital certificate has been installed. Digital<br />

certificates have already been created for the Application Server.<br />

<strong>The</strong> following examples use annotations, programmatic security, and/or declarative security to<br />

demonstrate adding security to existing web applications:<br />

■ “Example: Using Form-Based Authentication with a JSP Page” on page 863<br />

■ “Example: Basic Authentication with a Servlet” on page 873<br />

■ “Example: Basic Authentication with JAX-WS” on page 881<br />

■ “Discussion: Securing the Duke’s Bank Example” on page 829<br />

Examples: SecuringWeb Applications<br />

<strong>The</strong> following examples demonstrate adding basic authentication to an EJB endpoint or<br />

enterprise bean:<br />

■ “Example: Securing an Enterprise Bean” on page 818<br />

■ “Example: Using the isCallerInRole and getCallerPrincipal Methods” on page 823<br />

■ “Discussion: Securing the Duke’s Bank Example” on page 829<br />

Example: Using Form-Based Authentication with a JSP<br />

Page<br />

This example discusses how to use form-based authentication with a basic JSP page. With<br />

form-based authentication, you can customize the login screen and error pages that are<br />

presented to the web client for authentication of their user name and password. When a user<br />

submits their name and password, the server determines if the user name and password are<br />

those of an authorized user and, if authorized, sends the requested web resource. If the topic of<br />

authentication is new to you, please refer to the section “Specifying an Authentication<br />

Mechanism” on page 854.<br />

In general, the following steps are necessary for adding form-based authentication to an<br />

unsecured JSP page, such as the one described in “Web Modules” on page 81. In the example<br />

Chapter 30 • SecuringWeb Applications 863

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

Saved successfully!

Ooh no, something went wrong!