concept role in category ejb

appears as: role, roles, A role, role, roles
EJB 3 in Action, Second Edition

This is an excerpt from Manning's book EJB 3 in Action, Second Edition.

Prior to EJB 3.1 most developers of applications with a web front-end probably used a “startup servlet” to fulfill the role of an EJB singleton bean. The servlet was configured to eagerly start by the web container via settings in web.xml. The startup logic was placed in the init method of the servlet. Common tasks such as configuring logging, initializing database connections, and caching frequently accessed data in memory were implemented here. Cached data was then placed in the application session scope of the web application container. Special constructs were then necessary to synchronize updating of the cached data, which could be especially tricky if the application was load-balanced across multiple servers. This wasn’t an optimal solution.

6.4.2. User, groups, and roles

Users, groups, and roles are three interrelated concepts that form the basic building blocks of EJB security. We’ve already mentioned users, so let’s start with groups. To simplify, administration users are divided into groups as shown in figure 6.4. Groups are a logical partition for the application to identify users who should have access to different functions—for example, to administrative functions, customer service support, and so on. All users in the Administrator group can reset accounts and check account activity, whereas users in the Customer Service group can only change the status of an order. The application checks to see if the user is a member of the group before performing an operation. User/group functionality with EJB security is thus analogous to groups in the Unix file system, which simplifies the management of access lists for individual resources.

Figure 6.4. Users and groups

A role is closely related to the concept of a group. A role is an application container’s abstraction of a group. A mapping is typically created to associate application groups to Enterprise application roles. This separation enables applications to be coded independently of their deployment environment. An application might be developed with more fine-grained access controls than presently supported, or it might be purchased from an external vendor that obviously isn’t familiar with the company’s internal roles. Thus, this abstraction dissociates groups from the actual group names used in production. An application might have an Administrator group, whereas a company’s LDAP directory has a role Department Head that is equivalent. The mapping between the two is application server-specific—many containers can automatically make associations if the group and role names match.