background image

Protecting the Enterprise Beans

<< Database Tables | Application Client >>
<< Database Tables | Application Client >>

Protecting the Enterprise Beans

Figure 37­2
uses several abbreviations. PK stands for primary key, the value that uniquely
identifies a row in a table. FK is an abbreviation for foreign key, which is the primary key of the
related table. Tx is short for transaction, such as a deposit or withdrawal.
Protecting the Enterprise Beans
In the Java EE platform, you protect an enterprise bean by specifying the security roles that can
access its methods. In the Duke's Bank application, you define two roles, bankCustomer and
bankAdmin
, because two categories of operations are defined by the enterprise beans.
A user in the bankAdmin role will be allowed to perform administrative functions: creating or
removing an account, adding a customer to or removing a customer from an account, setting a
credit line, and setting an initial balance. A user in the bankCustomer role will be allowed to
deposit, withdraw, and transfer funds, make charges and payments, and list the account's
transactions. Notice that there is no overlap in functions that users in either role can perform.
The system restricts access to these functions to the appropriate role by setting method
permissions on selected methods of the CustomerControllerBean, AccountControllerBean,
and TxControllerBean enterprise beans. For example, by allowing only users in the bankAdmin
role to access the createAccount method in the AccountControllerBean enterprise bean, you
deny users in the bankCustomer role (or any other role) permission to create bank accounts.
Customer
customer_id (PK)
last_name
first_name
middle_initial
street
city
state
zip
phone
email
Account
account_id (PK)
type
description
balance
credit_line
begin_balance
begin_balance_
time_stamp
Tx
tx_id (PK)
account_id (FK)
time_stamp
amount
balance
description
Customer_Account_Xref
customer_id (FK)
account_id (FK)
One Many
One
Many
One
Many
FIGURE 37­2
Database Tables
Enterprise Beans
Chapter 37 · The Duke's Bank Application
1063