title: Implementing IPermission
body: <p>I'm considering writing a custom <code>IPermission</code> implementation but am not clear as to how it should work. I've already implemented <code>IPrincipal</code> and <code>IIdentity</code>. What I would like to accomplish is to be able to check permissions vis a vis the current <code>IPrincipal</code>'s authorizations rather than its roles. Generally, authorizations are read/add-delete/update/none for a given type. So I would like to write something like this:</p>
  
  <pre><code>[CustomPermission(SecurityAction.Demand, Type = typeof(Foo), MinimumAuthorization = AuthorizationFlags.Read)]
  public void SomeMethod(){}
  </code></pre>
  
  <p>Is this possible? I've looked over the code at <a href="http://msdn.microsoft.com/en-us/library/system.security.ipermission.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.security.ipermission.aspx</a>. This shows how to implement the interface, but I don't understand how the above pseudo-code would be able to check against the <code>IPrincipal</code>'s authorizations for the type.</p>