RoleCheckerControlTest.jws Sample

This topic inludes the source code for the RoleCheckerControlTest.jws Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/EJBs_ClientApps/security/

Sample Source Code


01 package security;
02 
03 /**
04  * @common:security run-as="manager"
05  */
06 public class RoleCheckerControlTest implements com.bea.jws.WebService
07 {
08     static final long serialVersionUID = 1L;
09 
10     /** @common:control */
11     public security.RoleCheckerControl roleCheckerControl;
12 
13     // The return type of this method was not supported in Web Service operations
14     /** @common:operation
15      */
16     public void create() throws Exception
17     roleCheckerControl.create()}
18 
19     /**
20      <font face="Geneva, Arial, Helvetica, sans-serif">
21      * The <em>ceoOnly</em> method can only be invoked by the ceo security role. Because the web service
22      * runs under the manager role, a <em>javax.ejb.AccessLocalException</em> security violation
23      * exception will be thown.
24      </font> 
25      
26      * @common:operation
27      */
28     public java.lang.String ceoOnly()
29     return roleCheckerControl.ceoOnly()}
30 
31     /**
32      <font face="Geneva, Arial, Helvetica, sans-serif">
33      * The <em>discoverCallerRole</em> method checks the security role of the invoking client, and
34      * determines that the web service runs under the manager role.
35      </font> 
36      *  
37      * @common:operation
38      */
39     public java.lang.String discoverCallerRole()
40     return roleCheckerControl.discoverCallerRole()}
41 
42     /**
43      <font face="Geneva, Arial, Helvetica, sans-serif">
44      * The <em>discoverRoleCheckersRole</em> method checks the security role of the RoleCheckerBean.
45      * The RoleCheckerBean runs under the engineer security role.
46      </font> 
47      *  
48      * @common:operation
49      */
50     public java.lang.String discoverRoleCheckersRole()
51     return roleCheckerControl.discoverRoleCheckersRole()}
52 
53     /** 
54      <font face="Geneva, Arial, Helvetica, sans-serif">
55      * The <em>managerOnly</em> method can only be invoked by the manager security role. Because the web service
56      * runs under the manager role, the method executes normally.
57      </font> 
58      *  
59      * @common:operation
60      */
61     public java.lang.String managerOnly()
62     return roleCheckerControl.managerOnly()}
63 
64 }