惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Security Affairs
S
Secure Thoughts
P
Proofpoint News Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Schneier on Security
V
Vulnerabilities – Threatpost
Security Archives - TechRepublic
Security Archives - TechRepublic
T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
Latest news
Latest news
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
T
Troy Hunt's Blog
H
Heimdal Security Blog
美团技术团队
Webroot Blog
Webroot Blog
P
Proofpoint News Feed
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
U
Unit 42
Google DeepMind News
Google DeepMind News
V2EX - 技术
V2EX - 技术
G
Google Developers Blog
N
News and Events Feed by Topic
Project Zero
Project Zero
The Register - Security
The Register - Security
N
Netflix TechBlog - Medium
IT之家
IT之家
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
News and Events Feed by Topic
Simon Willison's Weblog
Simon Willison's Weblog
L
Lohrmann on Cybersecurity
Schneier on Security
Schneier on Security
博客园_首页
Help Net Security
Help Net Security
AWS News Blog
AWS News Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security @ Cisco Blogs
PCI Perspectives
PCI Perspectives
Cisco Talos Blog
Cisco Talos Blog
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Docker
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
阮一峰的网络日志
阮一峰的网络日志
Spread Privacy
Spread Privacy
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Hacker News
The Hacker News

博客园 - vibration

ATL3.0组件注册bug的解决方法 奇怪的引用错误及解决方法 OLE2T在VS2003中转换中文失败的问题及解决方法 标题栏按钮的WTL实现 AppBar的WTL实现 招聘C++和C#开发工程师 ATL组件中文路径注册问题(转载) 关于C++模板的连接问题 - vibration - 博客园 用窗口消息解决COM接口的多线程访问问题 用全局接口表实现COM接口在不同线程中的传递 MyMSN支持自定义内容了 自画菜单的WM_MEASUREITEM只会发送一次 悼念皮皮 上了点照片 一个测试记忆力的小游戏 老板该如何向核心员工许诺 ActiveScript SkinX界面换肤框架更新 Skin技术实现框架(完)
反射获取定制Attribute
vibration · 2004-06-01 · via 博客园 - vibration

前段时间写了扩展.net安全机制(1, 2),当时做了些试验代码,关于用户权限控制的功能是没有问题的,但关于权限管理却没有做实际的代码进行试验。当时想当然的认为可以通过反射机制读取到定制安全属性的内容,这几天开始做实际的代码,却发现并没有这么简单
我的目标是这样的,打开一个dll文件,通过反射得到其所有类和方法,并调用GetCustomAttributes方法获取其Attribute,然后读取这些Attribute记录的数据并入库管理。可是,现在发现GetCustomAttributes方法好像不能得到从CodeAccessSecurityAttribute继承的属性。我尝试了自己定义的安全Attribute和.net提供的PrincipalPermissionAttribute,都不行。用.NET Reflector看了一下反编译后的代码,发现这些Attribute变成了PermissionSetAttribute。可是,既然Reflector可以看到PermissionSetAttribute,那么我自己的代码通过反射应该至少也可以看到这个啊,看来还需要继续研究
不过,就目前情况,也有个不太完美的解决方案,就是除了安全Attribute,再定义一个普通的定制Attribute,记录需要管理的信息,这个普通的Attribute是可以通过GetCustomAttributes得到的,这个我已经试验过。这个方案不完美的地方就是要为需要安全控制的对象加两个Attribute,而且要保证其内容一致。确实不完美,不过可以用,也许只能采用这个方案了

posted on 2004-06-01 11:38  vibration  阅读(1831)  评论()    收藏  举报