> We've been looking into implementing the servlet "run-as" tag for > Jetty/JBoss. > > So far, Greg has added the following methods to the > org.mortbay.http.UserRealm interface: > > > public UserPrincipal pushRole(UserPrincipal user, String role); > public UserPrincipal popRole(UserPrincipal user); > > The intention being to create a "new" principal, based on the old, > with a role added. The new principle is associated with the request > while it is within the run-as servlet. The popRole call ends this > association and should return either the original principal or another > equivalent principal stripped of the role (assuming it did not have it > in the first place). > This is not my interpretation of the run-as behavior. Rather, there needs to be a seperate principal identity that has only the run-as role. Below are sections from the servlet 2.3 and ejb 2.0 spec that talk about the run-as behavior. My interpretation is that the user defines the role to use for authorization, and the deployer has to configure the principal which will be used as the caller identity. There will need to be a jboss specific element that defines the principal to which the run-as role is associated.
This principal and role are pushed as the thread of control security identity on entrace into the servlet and popped on exit. Only the current thread is affected for the scope the servlet request. The current change in UserRealm is probably fine. The security information available to the UserRealm implementation needs to be augmented to provide a servlet context to run-as information mapping. <servlet-2.3 spec, page 85> SRV.12.7 Propagation of Security Identity in EJB Calls A security identity, or principal, must always be provided for use in a call to an enterprise bean. The default mode in calls to enterprise beans from web applications is for the security identity of a web user to be propagated to the EJB container. In other scenarios, web containers are required to allow web users that are not known to the web container or to the EJB container to make calls: . Web containers are required to support access to web resources by clients that have not authenticated themselves to the container. This is the common mode of access to web resources on the Internet. . Application code may be the sole processor of signon and customization of data based on caller identity. In these scenarios, a web application deployment descriptor may specify a run-as element. When it is specified, the container must propagate the security identity of the caller to the EJB layer in terms of the security role name defined in the run-as element. The security role name must [be] one of the security role names defined for the web application. For web containers running as part of a J2EE platform, the use of run-as elements must be supported both for calls to EJB components within the same J2EE application, and for calls to EJB components deployed in other J2EE applications. </servlet-2.3 spec> <ejb-2.0 spec, page 434> The security principal under which a method invocation is performed is typically that of the component's caller. By specifying a run-as identity, however, it is possible to specify that a different principal be substituted for the execution of the methods of the bean's home and component interfaces and any methods of other enterprise beans that the bean may call. The Application Assembler specifies in the deployment descriptor whether the caller's security identity or a run-as security identity should be used for the execution of the bean's methods. See section 21.3.4. The Application Assembler should specify the requirements for the caller's principal management of enterprise bean invocations by means of the security-identity deployment descriptor element and as part of the description. If use-caller-identity is specified as the value of the security- identity element, the caller principal is propagated from the caller to the callee. (That is, the called enterprise bean will see the same returned value of the EJBContext.getCallerPrincipal() as the calling enterprise bean.) If the run-as element is specified, a security principal that has been assigned to the specified security role will be used for the execution of the bean's methods and will be visible as the caller principal in the callee. </ejb-2.0 spec> _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
