3.7 J2EE Platform Roles
J2EE defines roles that reflect the responsibilities within an organization. Any person or software involved in the process of making an application available within an enterprise can usually be categorized into organization roles, called J2EE platform roles. The J2EE platform roles having security responsibilities are the Application Component Provider, Application Assembler, Deployer, System Administrator, J2EE Product Provider, and Tool Provider. The J2EE security model is defined with respect to these J2EE roles.
Figure 3.4 shows the interactions among the Application Component Provider, Application Assembler, Deployer, and System Administrator. These are the roles involved, from a security perspective, in the stages between development and deployment.
Figure 3.4. J2EE Platform Roles with Security Responsibilities in the Development and Deployment of a J2EE Application
Figure 3.4 depicts the software process cycle from the perspective of J2EE platform roles.1 In a typical J2EE software process cycle, application component developers build enterprise application components, such as servlets or enterprise beans. The greatest opportunity for component reuse and flexibility in reconfiguring security policy is when the components are written to be security unaware, meaning that they do not contain embedded security policy code. Conversely, components containing embedded security policy code are said to be security aware. Security-aware components are difficult to reuse, and flexibility is limited because it often requires changing the source code to reflect various security policies. For some applications, this may be unavoidable.
An Application Assembler integrates a set of components supplied by one or more Application Component Providers. The Application Assembler has the in-depth knowledge of the application. The Application Assembler specifies security policies as hints to the Deployer. For example, the Application Assembler can provide hints such that the approve() method of an enterprise bean should be accessed only by those principals granted the role of a Manager.
A Deployer deploys enterprise applications, assembled by Application Assemblers, into an operational environment. When tailoring the security policies to the operational environment, the Deployer consults the security policy hints provided by the Application Assembler. For example, the Deployer can assign the role of a Manager to a user named Bob.
A System Administrator is responsible for administering the system, including security. This may include configuring the J2EE product to use an LDAP server for managing security information, including user and group membership.
The following subsections provide a more detailed description of the four J2EE roles. The J2EE platform roles that we have listed are considered to be the typical roles, although in practice, the roles are adapted to better match the organization's application development and deployment work flow. The rest of this section summarizes the major responsibilities of the individual J2EE platform roles with respect to security management.
3.7.1 Application Component Provider
The Application Component Provider is the J2EE platform role responsible for implementing the business logic as a set of J2EE application componentsenterprise beans, servlets, and/or JSP files. These components are packaged in an ejb-jar file containing one or more enterprise beans and/or a WAR file containing one or more servlets and/or JSP files, and/or a JAR file containing an application client module.
The Application Component Provider has numerous responsibilities in code development. These responsibilities range from resource access to programmatic access of the caller's security context. Following are the Application Component Provider's key security responsibilities:
188.8.131.52 Access of Resources in the Underlying Operating System
The J2EE architecture does not define the operating system principalfor example, the operating system userunder which EJB methods or servlets execute. Therefore, the Application Component Provider cannot rely on a specific principal for accessing the underlying operating system resources. The Application Component Provider should design the applications so that special privileges are not required to access system resources.
184.108.40.206 Security Recommendations
The Application Component Provider should avoid implementing security mechanisms or hard-coded security policies in the component but instead should rely on the security mechanisms provided by the J2EE container. The Application Component Provider should let the Application Assembler and the Deployer define the appropriate security policies for the application. The Application Component Provider can use the deployment descriptors to convey security-related information to the Application Assembler.
220.127.116.11 Programmatic Access to the Caller's Security Context
Programmatic-security APIs should be avoided when possible. However, they should be used when the J2EE component methods need access to security-context information because the J2EE declarative security model is insufficient to implement application security requirements.
18.104.22.168 Conveying the Use of Role References
A security role is a set of J2EE authorizations. The Application Component Provider may build a security-aware application and use role referencessecurity role names within the application components. For example, a component may call isUserInRole("Manager") on a javax.servlet.http.HttpServletRequest object. When security role names are hard-coded in an application component, the Application Component Provider must identify these role names for the Application Assembler so that it can map component-defined security role references in each of the components in the deployment to a single application-level security role name. For example, two components in an application may use the security role references Manager and Boss within the component, whereas both of these roles imply the application security role of a Supervisor.
3.7.2 Application Assembler
The Application Assembler is the J2EE platform role responsible for combining J2EE components into deployable application units. The Application Assembler also simplifies the Deployer's job by providing a security view of the enterprise beans, servlets, and JSP files in the relevant deployment descriptors. A security view consists of a set of J2EE security roles. A security role is a semantic grouping of J2EE authorizations, or permissionsimplemented as java.security.Permission objectsthat a given type of application users must have in order to successfully use the application. The Application Assembler defines one or more security roles in the deployment descriptor and specifies and associates J2EE permissions with these roles. For example, the security role Manager could be granted the J2EE permissions to invoke an enterprise bean to grant loans and view the loan status of all the customers using Web applications. In contrast, the security role HelpDesk could be granted only a subset of these J2EE permissionsfor example, only the J2EE permission to view the loan status of the customersby having been granted access to the relevant URIs.
Following are some of the Application Assembler's security responsibilities.
22.214.171.124 Defining EJB Method Permissions
The home, local home, remote, and local interfaces of an enterprise bean are defined as part of the EJB specification.
The home interface of an enterprise bean is a Java interface used to create, find, or delete an instance of the enterprise bean. The methods defined in the remote interface can be accessed from within the same container or remotely via RMI-IIOP.
The local home interface of an enterprise bean is functionally similar to the home interface, but the methods defined in the local home interface are accessible only from within the same container.
The remote interface of an enterprise bean is a Java interface that defines the operations that can be performed on the enterprise bean to access the business logic associated with the enterprise bean itself. The methods defined in the remote interface can be accessed from within the same container or remotely via RMI-IIOP.
The local interface of an enterprise bean is functionally similar to the remote interface, but the methods defined in the local interface are accessible only from within the same container.
The home, local home, remote, and local interfaces of an enterprise bean define which methods the enterprise bean exposes to a client. An EJB method permission is defined by an XML method-permission element in an EJB module's deployment descriptor and is used to assign groups of methods of the home, local home, remote, and local interfaces of an enterprise bean packaged in that EJB module to the security roles. This way, the Application Assembler can define the security view of the enterprise bean.
An EJB method permission specifies the methods of the home, local home, remote, and local interfaces that each of the listed security roles is allowed to invoke. This implies that an EJB method permission may include a list of one or more security roles and a list of one or more methods. In addition, a security role or a method may appear in multiple XML method-permission elements. Users of particular security roles are granted access to all the methods listed in all the EJB method permission elements where those security roles appear. EJB method permissions and the deployment descriptor are discussed further in Chapter 5 on page 157.
126.96.36.199 Defining Web Resources Security Constraints
An Application Assembler uses a Web module's deployment descriptor to define security constraints for a Web application packaged in that module. The Web module's deployment descriptor's auth-constraint element is used for this purpose. This element consists of one or more security roles and a list of URL patterns that users with any of those security roles are authorized to invoke. Specifically, deployment descriptors are used to assign groups of URL patterns to the security roles, thus defining security views of Web applications. Login configuration information, such as requiring a user to be authenticated using a form-based login mechanism, and transport guarantee constraints, such as requiring access to a URL pattern to be submitted only using an HTTPS connection, can also be specified in the deployment descriptor.
188.8.131.52 Declaring Security Roles within a J2EE Application
An Application Assembler defines each security role by using the security-role XML element in the relevant deployment descriptor.
If the deployment descriptor belongs to an ejb-jar file, the security-role element is scoped to that ejb-jar file and applies to all the enterprise beans in that EJB module.
If the deployment descriptor belongs to a WAR file, the security role element is scoped to that WAR file and applies to all the servlets and/or JSP files in that Web module.
If the deployment descriptor belongs to an EAR file, the security-role element applies to all the JAR and WAR files that are packaged within that EAR file. Effectively, the set of security roles declared in the EAR file's deployment descriptor is the union of the security roles defined in the deployment descriptors of the JAR and WAR files packaged within that EAR file. Technically, however, the security roles described in the constituent modules of an EAR file are the ones that are used to enforce authorization, because those roles are associated with authorization policies. The roles declared in the EAR file's deployment descriptor are typically used for administration and management purposes only. For example, they can be used to assign security roles to principals with regard to the whole application packaged in the EAR file.
The deployment descriptor of an application client module does not contain security role elements, because security roles are specific to the server side of a J2EE application, not for the client.
Within each security-role element, the Application Assembler will use the role-name subelement to define the name of the security role and, optionally, will use the description subelement to provide a description of the security role.
For each J2EE application, the Deployer takes the modules comprising that application and deploys the module components into a specific operational, or runtime, environment. The modules were produced by an Application Assembler. The operational environment in which the application is deployed includes a specific J2EE container. The Deployer is also responsible for ensuring the security of an assembled application when it is deployed in the target operational environment.
The Deployer has the following responsibilities with respect to security management.
184.108.40.206 Reading the Security View of the J2EE Application
The Deployer uses the deployment tools supplied by the J2EE Product Provider to read the security view of the application. The Deployer should treat the security policies specified in a deployment descriptor as hints and modify those policies as appropriate to the operational environment in which the application is being deployed.
220.127.116.11 Configuring the Security Domain
A security domain within an enterprise represents an instance of an authentication authority and relevant security infrastructure. For example, a security domain may point to a particular Kerberos domain for authentication and an LDAP user repository to deduce user and group membership to be used for authorization. In the case of multiple security domains within the enterprise, the Deployer is responsible for configuring the J2EE product to use the appropriate security domains.
18.104.22.168 Assigning of Principals to Security Roles
The Deployer is responsible for assigning principals and/or groups of principals used for managing security in the runtime to the security roles defined in the XML security-role elements of the deployment descriptors. The process of assigning the logical security roles defined in the J2EE application's deployment descriptor to the operational environment's security concepts is specific to the configuration capabilities of a particular J2EE product.
22.214.171.124 Configuring Principal Delegation
Delegation allows an intermediary to perform a task, initiated by a client, under an identity based on a delegation policy. The Deployer is responsible for configuring principal delegation for intercomponent calls by using the appropriate deployment descriptor elements, as follows.
If the deployment descriptor belongs to an ejb-jar file, the Deployer uses the security-identity deployment descriptor element for this purpose. When the value of the security-identity element is use-caller-identity, the identity of the caller of the enterprise bean will be used when calling other components from the enterprise bean. When the value specified is run-as, the identity of the caller to the enterprise bean will be propagated in terms of the security role name defined in the run-as element of the descriptor. For example, if the caller to an enterprise bean is user Bob, Bob's identity will be used if the security-identity element is set to use-caller-identity. If the security-identity element is set to run-as and the role name is Teller, the downstream calls from the enterprise bean will be performed in terms of the Teller role.
If the deployment descriptor belongs to a WAR file, the Deployer uses the run-as deployment descriptor element for this purpose. If the run-as element is not declared in the WAR file, the identity of the servlet's caller will be used for components called from the servlet. If the run-as element is declared in the deployment descriptor, the identity passed when the servlet makes calls to other components will be that of the security role name defined in the run-as element of the descriptor. For example, if the caller to a servlet is user Bob, Bob's identity will be used if no run-as element is declared in the WAR file's deployment descriptor. If the run-as element is declared in the deployment descriptor and the role name is Teller, the downstream calls from the servlet will be performed in terms of the Teller role.
3.7.4 System Administrator
The System Administrator is responsible for the configuration and administration of the enterprise's computing and networking infrastructure, including the J2EE container. The System Administrator is also responsible for the overall management and operational aspects of the J2EE applications at runtime. The following list describes the security-related responsibilities of the System Administrator. Some of these responsibilities may be carried out by the Deployer or may require the cooperation of both the Deployer and the System Administrator.
126.96.36.199 Administering the Security Domain
The System Administrator is responsible for administering the security domain. This includes the principal administration, user account management, group membership assignment, deployment of J2EE products within an enterprise environment, including configuration of DMZs, firewalls, user registries, and so on. These are typically performed using the tools provided by the relevant product vendor; for example, user registry management is performed using an LDAP server product, firewall configuration using the firewall product, and so on.
188.8.131.52 Assigning Application Roles to Users and Groups
The System Administrator is responsible for assigning principals and/or groups of principals used for managing security in the runtime to the security roles defined in the XML security-role elements of the deployment descriptors. The process of assigning the logical security roles defined in the J2EE application's deployment descriptor to the operational environment's security concepts is specific to the configuration capabilities of a particular J2EE product. For example, using the tools provided by a J2EE product, the System Administrator can assign a Teller role scoped to a J2EE application FinanceApp to user Bob and group TellerGroup.
3.7.5 J2EE Product Provider
The J2EE Product Provider has the following areas of responsibility.
184.108.40.206 Supplying Deployment Tools
The J2EE Product Provider is responsible for supplying the deployment tools that the Deployer uses to perform all the deployment tasks, including the security-related tasks. For example, the J2EE Product Provider will supply tools to perform security-role-to-principal and/or -user and/or -group assignment.
220.127.116.11 Configuring Security Domains
The J2EE Product Provider is responsible for configuring the J2EE product to use appropriate security domains. For example, the J2EE Product Provider needs to supply facilities to configure the J2EE product to use a particular authentication mechanismfor example, to use a Kerberos domain.
18.104.22.168 Supplying Mechanisms to Enforce Security Policies
The J2EE Product Provider is responsible for supplying the security mechanisms necessary to enforce the security policies set by the Deployer. This includes authentication of principals, authorization to perform EJB/servlet calls, configuration of resource adapters defined in the JCA, and secure communication with remote clients, integrity, and confidentiality.
22.214.171.124 Providing Tools for Principal Delegation
The J2EE Product Provider is responsible for passing principals on EJB/servlet calls. In particular, the J2EE Product Provider is responsible for providing the deployment tools that allow the Deployer to configure principal delegation for calls from one J2EE component to another.
126.96.36.199 Providing Access to the Caller's Security Context
The J2EE Product Provider is responsible for providing access to the caller's security context information when programmatically queried from enterprise beans and servlets using the J2EE-defined security APIs. For example, when a servlet calls getUserPrincipal() on a javax.servlet.http.HttpServletRequest object, the J2EE Product Provider must return the java.security.Principal object representing the caller of the servlet.
188.8.131.52 Supplying Runtime Security Enforcement
One of the most significant responsibilities of the J2EE Product Provider is to supply runtime security enforcement, as follows.
Provide enforcement of the client access control as specified by the current security policy.
Isolate an enterprise bean instance from other instances and other application components running on the server, thus preventing unauthorized access to privileged information.
Provide runtime facilities to implement the principal-delegation policies set in the deployment descriptor.
Allow a J2EE application to be deployed independently multiple times, each time with a different security policy.
184.108.40.206 Providing a Security Audit Trail
Optionally, the J2EE Product Provider may provide a security audit trail mechanism whereby secure access to enterprise beans and Web resources is logged. Such audit logs can be used to determine the information about the activity on the J2EE components. For example, these logs can be used to discover unauthorized attempts to access enterprise beans and Web resources.