Re: fine grained security with SubjectTrackingMBeanServer example

"Simone Bordet" <[email protected]>
Newsgroups gmane.comp.java.mx4j.user
Message-ID <[email protected]>
Hi Luis-Miguel,

> When the JMX client calls mbsc.addNotificationListener() for the first time
> the connector server needs to register a listener on the MBeanServerDelegate
> MBean to listen for register/unregister MBean notifications. This call is made
> on behalf of the connector server (and not on behalf of the authenticated user)
> and thus no Subject will be available in the thread's context but the call will
> still go through the MBeanServerForwarder (i.e. your SubjectTrackingMBeanServer)
> and that's where your code throws a NullPointerException.

This is an implementation detail of the RI, and IMHO it is bad that it
behaves this way, breaking the least surprise rule.
If I am calling the remote MBeanServer *once* to add a listener, why
the forwarder gets called *twice* ?

> A solution to this problem might be having a special case for adding listeners
> to the MBeanServerDelegate MBean in your MBeanServerForwarder where a null
> Subject might be accepted.

This is even worse, because you cannot distinguish when a call is
really made without credentials, or it's an implementation artifact.
How can I distinguish when I should reject the call (because there are
no credentials) or let it through (because it's an implementation
artifact) ?
Furthermore, this solution makes code non-portable and heavily
dependent on the implementation used, which was the reason JMX was
standardized.

I consider this a bug of the RI. Your thoughts ?

Simon
-- 
http://bordet.blogspot.com

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.