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.

hr-department<br />

<br />

<br />

<br />

This role includes the employees of the payroll<br />

department. <strong>The</strong> role is allowed to view and<br />

update the payroll entry for any employee.<br />

<br />

payroll-department<br />

<br />

<br />

<br />

This role should be assigned to the personnel<br />

authorized to perform administrative functions<br />

for the employee self-service application.<br />

This role does not have direct access to<br />

sensitive employee and payroll information.<br />

<br />

admin<br />

<br />

...<br />

<br />

Linking Security Role References to Security Roles<br />

<strong>The</strong> security role references used in the components of the application are linked to the security<br />

roles defined for the application. In the absence of any explicit linking, a security role reference<br />

will be linked to a security role having the same name.<br />

You can explicitly link all the security role references declared in the @DeclareRoles annotation<br />

or security-role-ref elements for a component to the security roles defined by the use of<br />

annotations (as discussed in “Defining Security Roles” on page 802) and/or in the<br />

security-role elements.<br />

You use the role-link element to link each security role reference to a security role. <strong>The</strong> value<br />

of the role-link element must be the name of one of the security roles defined in a<br />

security-role element, or by the @DeclareRoles or @RolesAllowed annotations (as discussed<br />

in “Defining Security Roles” on page 802). You do not need to use the role-link element to<br />

link security role references to security roles when the role-name used in the code is the same as<br />

the name of the security-role to which you would be linking.<br />

<strong>The</strong> following example illustrates how to link the security role reference name payroll to the<br />

security role named payroll-department:<br />

...<br />

<br />

Securing Enterprise Beans<br />

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

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

Saved successfully!

Ooh no, something went wrong!