
Use this procedure to specify the methods of the beans' home and component interfaces, which the security roles are allowed or disallowed to invoke. These permissions are specified in ejb-jar.xml.
Setting Method Permissions
A dialog box appears in which you can choose the methods to which you want to apply the permissions. If you choose a whole bean, the method permissions will be applied to all the bean methods.
The selected methods appear as sub-nodes under a method-permission node.
The properties of each method-permission sub-node are stored in a separate <method-permission> element in the deployment descriptor.
The security roles appear in the Role Names field. Each of the chosen security roles is allowed to invoke each of the listed methods.
The value of this field can be one of the following: Home , Remote , LocalHome , Local .
The following code excerpt shows an example of method permission settings.
<method-permission> <description>Specifies the method permissions for customers</description> <role-name>carCustomer</role-name> <method> <ejb-name>OrderBean</ejb-name> <method-intf>Remote</method-intf> <method-name>login</method-name> <method-params> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> </method-params> <method> <method> <ejb-name>OrderBean</ejb-name> <method-intf>Remote</method-intf> <method-name>makeOrder</method-name> <method-params> <method-param>int</method-param> <method-param>java.lang.String</method-param> <method-param>java.lang.String</method-param> </method-params> <method> </method-permission>
Denying Access to Methods
You can specify a set of methods that cannot be called and, as a result, neither of these methods can be accessed.
A dialog box appears in which you can choose the methods that you want to add to the list. If you choose a whole bean, all the bean's methods will be added to the list.
The selected methods appear as sub-nodes under an exclude-list node.
The value of this field can be one of the following: Home , Remote , LocalHome , Local .
The contents of the exclude-list sub-node is stored in the <exclude-list> element in the deployment descriptor:
<exclude-list> <description>Contains methods, which cannot be accessed.</description> <method> <description>This method removes all orders.</description> <ejb-name>OrderBean</ejb-name> <method-intf>Remote</method-intf> <method-name>deleteAll</method-name> </method> </exclude-list>