Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, Version 2.0 - Sun Microsystems.pdf
Скачиваний:
14
Добавлен:
24.05.2014
Размер:
2.71 Mб
Скачать

Sun Microsystems Inc.

Security management

Enterprise JavaBeans 2.0, Public Draft

Application Assembler’s responsibilities

20.3.3 Linking security role references to security roles

If the Application Assembler defines the security-role elements in the deployment descriptor, he or she is also responsible for linking all the security role references declared in the secu- rity-role-ref elements to the security roles defined in the security-role elements.

The Application Assembler links each security role reference to a security role using the role-link element. The value of the role-link element must be the name of one of the security roles defined in a security-role element.

A role-link element must be used even if the value of role-name is the same as the value of the role-link reference.

The following deployment descriptor example shows how to link the security role reference named payroll to the security role named payroll-department.

...

<enterprise-beans>

...

<entity> <ejb-name>AardvarkPayroll</ejb-name>

<ejb-class>com.aardvark.payroll.PayrollBean</ejb-class>

...

<security-role-ref> <description>

This role should be assigned to the employees of the payroll department. Members of this role have access to anyone’s payroll record.

The role has been linked to the payroll-department role.

</description> <role-name>payroll</role-name> <role-link>payroll-department</role-link>

</security-role-ref>

...

</entity>

...

</enterprise-beans>

...

20.3.4 Specification of security identities in the deployment descriptor

The Application Assembler typically specifies whether the caller’s security identity should be used for the execution of the methods of an enterprise bean or whether a specific runAs identity should be used.

The Application Assembler uses the security-identity deployment descriptor element for this purpose. The value of the security-identity element is either use-caller-identity or runAs-specified-identity. The use-caller-identity element cannot be specified for message-driven beans.

5/31/00

416

Sun Microsystems Inc

Application Assembler’s responsibilities

Enterprise JavaBeans 2.0, Public Draft

Security management

Defining the security identities in the deployment descriptor is optional for the Application Assembler. Their omission in the deployment descriptor means that the Application Assembler chose not to pass any instructions related to security identities to the Deployer in the deployment descriptor.

20.3.4.1 RunAs

The Application Assembler can use the runAs-specified-identity element to define a runAs identity for an enterprise bean in the deployment descriptor. The runAs identity applies to the enterprise bean as a whole, that is, to all methods of the enterprise bean’s home and remote interfaces or to the onMessage method of a message-driven bean.

Because the Application Assembler does not, in general, know the security environment of the operational environment, the runAs identity is designated by a logical role-name, which corresponds to one of the security roles defined by the Application Assembler in the deployment descriptor.

The Deployer then assigns a security principal defined in the operational environment to be used as the principal for the runAs identity. The security principal assigned by the Deployer must be a principal that has been assigned to the security role specified by the role-name element.

The Application Assembler is responsible for the following in the specification of runAs identities:

Use the role-name element to define the name of the security role.

Optionally, use the description element to provide a description of the principal that is expected to be bound to the runAs identity in terms of its security role.

The following example illustrates the definition of a runAs identity in the deployment descriptor.

...

<enterprise-beans>

...

<session>

<ejb-name>EmployeeService</ejb-name>

...

<security-identity>

<runAs-specified-identity>

<role-name>admin</role-name>

</runAs-specified-identity>

</security-identity>

...

</session>

...

</enterprise-beans>

...

417

5/31/00