Non-Custom Attributes 
Author Message
 Non-Custom Attributes

Hi,

I'm using declarative role-based security in a project at the moment making
extensive use of the PrincipalPermissionAttribute
(System.Security.Permissions).

Whenever permission is denied to a given user, I want to be to log who was
making the attempt and what permissions they required. Sounds fairly easy. I
can get the Identity.Name from the current thread and the required
permissions by retrieveing the PrincipalPermissionAttribute using the
Attribute.GetCustomerAttribute static method or the
MethodInfo.GetCustomAttribute method.

Trouble is, PrincipalPermissionAttribute is not a custom attribute so I can
not obtain it this way.

Does anybody know how I obtain a reference to this (or any other non-custom)
attribute?

Cheers
Ian



Sun, 04 Jul 2004 02:45:58 GMT  
 Non-Custom Attributes


Wed, 18 Jun 1902 08:00:00 GMT  
 Non-Custom Attributes
OK, after a bit more digging around it appears that all applicable security
attributes applied to a method (or type) are converted into a permission set
and embedded in the metadata. So, I don't think I can get back to the role
and name from the PrincipalPermissionAttribute.


Quote:
> Hi,

> I'm using declarative role-based security in a project at the moment
making
> extensive use of the PrincipalPermissionAttribute
> (System.Security.Permissions).

> Whenever permission is denied to a given user, I want to be to log who was
> making the attempt and what permissions they required. Sounds fairly easy.
I
> can get the Identity.Name from the current thread and the required
> permissions by retrieveing the PrincipalPermissionAttribute using the
> Attribute.GetCustomerAttribute static method or the
> MethodInfo.GetCustomAttribute method.

> Trouble is, PrincipalPermissionAttribute is not a custom attribute so I
can
> not obtain it this way.

> Does anybody know how I obtain a reference to this (or any other
non-custom)
> attribute?

> Cheers
> Ian



Sun, 04 Jul 2004 06:01:36 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Attributed and non-attributed code performance

2. Retriving attribute from custom attribute collection

3. Creating custom attribute in assembly and accessing attribute from different project

4. How to modify custom attributes from C# code ?

5. Custom Attribute

6. Custom Attribute Providers

7. Custom Attributes for automatic logging

8. Reflection: Propertygrid does not recognize custom attributes

9. Custom Attributes C#

10. Custom Attribute Example

11. Using Attribute to add custom registry entries

12. Can VC supports custom attribute?

 

 
Powered by phpBB® Forum Software