开发者

Custom Authentication Per Client

I am building an ASP.NET WCF Restful Service for several colleges. The service allows students to authenticate, therefore I will be leveraging some sort of central authentication at each College. For example one college may require authentication via Open LDAP while another may require Active Directory Authentication.

I need the ability to easily drop code into my project to change the authentication type (Open LDAP, Active Directory, etc..).

My solution is to create an interface and implement it in my Custom Authentication class. I would drop the compiled authentication class into my bin folder and add a key value entry into the web.config file which specifies the Assembly name and Class name. When a user Authenticates I would create t开发者_如何学Pythonhe class through reflection and use the interface methods to authenticate the user.

Is the above approach a good approach to handle custom authentication? Has anyone solved this using a different approach?

Thank you for your time.

Victor


You could just use the ASP.NET provider model or use MEF to look through your directories and assemblies to discover implementations of an interface. That way you don't have to write the reflection code yourself, and it will be correctly loaded on application initialization, rather than you creating it on every authentication attempt.


I think you can develop a custom service behavior, and in that behavior you can define your customized authentication ways. This link (http://www.codeproject.com/KB/WCF/Custom_Authorization_WCF.aspx) may help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜