[Mono-list] How to do code injection with .NET

Joshua Prismon josh@technicaldetails.org
Fri, 28 Feb 2003 11:39:36 -0700


I wrote something similar to this in .NET using ContextBoundObject. It
is possible (I believe) to create a new context for each method call in
one of the sinks. 

As a warning... It is really slow. Slow enough that I ended up
abandoning that approach. If you don't need to intercept the
constructors or the "this." , you can also just create a proxy on top of
the object that does a security check much much faster.

---------------------
Hi,

I've been reading a little about Aspect Oriented Design. And it seems
objects inheriting from ContextBoundObject allow you to do that,
although
with some limitation, i.e. the framework only work with a context per
class
maximum (I couldn't find a way to have a new context for every method
call
inside the same class).

I was wondering if I could do something like in J2EE, i.e.

  [Priviledge("EditProfile")]
  public void EditMethod(){
     ...
  }

The above would in turn inject code inside the method that would be like

public void EditMethod(){
  if(!
ContextUtils.GetPriviledgeContext().HasPriviledge("EditProfile")){
     throw Security("Insufficient priviledge");
  }
  ...
}


Is there a way at compile time (or runtime) to do this with mono (or
MS.NET)?

Thanks

Phil



_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list