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.

Accepting Unauthenticated Users<br />

Web applications accept unauthenticated web clients and allow these clients to make calls to the<br />

EJB container. <strong>The</strong> EJB specification requires a security credential for accessing EJB methods.<br />

Typically, the credential will be that of a generic unauthenticated user. <strong>The</strong> way you specify this<br />

credential is implementation-specific.<br />

In the Application Server, you must specify the name and password that an unauthenticated<br />

user will use to log in by modifying the Application Server using the Admin Console:<br />

1. Start the Application Server, then the Admin Console.<br />

2. Expand the Configuration node.<br />

3. Select the Security node.<br />

4. On the Security page, set the Default Principal and Default Principal Password values.<br />

Accessing Unprotected Enterprise Beans<br />

If the deployer has granted full access to a method, any user or group can invoke the method.<br />

Conversely, the deployer can deny access to a method.<br />

To modify which role can be used in applications to grant authorization to anyone, specify a<br />

value for Anonymous Role. To set the Anonymous Role field, follow these steps:<br />

1. Start the Application Server, then the Admin Console.<br />

2. Expand the Configuration node.<br />

3. Select the Security node.<br />

4. On the Security page, specify the Anonymous Role value.<br />

Enterprise Bean Example Applications<br />

Enterprise Bean Example Applications<br />

<strong>The</strong> following example applications demonstrate adding security to enterprise beans<br />

applications:<br />

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

authentication to an enterprise bean application.<br />

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

demonstrates the use of the getCallerPrincipal() and isCallerInRole(String role)<br />

methods.<br />

■ “Discussion: Securing the Duke’s Bank Example” on page 829 provides a brief discussion of<br />

how the Duke’s Bank example provides security in that application.<br />

Chapter 29 • Securing <strong>Java</strong> <strong>EE</strong> Applications 817

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

Saved successfully!

Ooh no, something went wrong!