Click here to Skip to main content
15,903,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi guys,

I try to find any good tutorials about Authentication and Authorization in WPF but i could not found any thing

all i found are about ASP.NET and WCF and MVC

I want complete and good tutorials about that for WPF

What I have tried:

I try to find any good tutorials about Authentication and Authorization in WPF but i could not found any thing
Updated 1-Sep-16 4:38am
Afzaal Ahmad Zeeshan 18-Jul-16 8:36am    
That is because WPF is not considered to be an application programming framework where users are to be connecting to access resources. WPF acts more like a client software development framework instead of being a server software development framework.

ASP.NET, WCF (MVC is the short form for ASP.NET MVC) are both server-side frameworks and thus they require to have a safe authentication system. Can you tell why you want to implement this? So that I can guide you further to implement it.
MrLonely_2 18-Jul-16 9:44am    
Thank you so much for reply, i am attend to make Application for Clinic, the doctor use it, accountants, nurse and others so i need to implement Authentication and Authorization in the App. because every user has its personal permissions
Afzaal Ahmad Zeeshan 18-Jul-16 17:23pm    
Continuing from your comment to the question. Well, the thing to note here is that you have yourself said that 3 (or more) type of people are going to use the software. In this case, using authentication and changing the view of the WPF won't be a good idea at all. What I would recommend on the other hand is that you create 3 (or more) applications for each of the person. Create a different application for doctor, let him/her use that, create other one for nurse and let him/her use that.

In my own opinion, authentication should be done on the data usage. How the data is being accessed and stored.
MrLonely_2 19-Jul-16 5:19am    
Thanks, i will try do it like your approach 14-May-18 11:40am    
Your answer did not help the question at all. You are suggesting he abandon the effort of implementing Authentication in favor of creating separate applications. For future readers seeking a way to implement Authentication your answer is a waste of time.

Please take a look at this article, that was the very first I've found by google with "Authentication and authorization in WPF" :)

"WPF: Implementing Custom Authentication And Authorization - TechNet Articles - United States (English) - TechNet Wiki[^]

This article provides a step-by-step code sample on how you can implement your own custom authentication and authorization in a WPF application by implementing classes that derive from the IIdentity and IPrincipal interfaces and overriding the application thread’s default identity.
Share this answer
MrLonely_2 18-Jul-16 8:02am    
thanks, but i read this article before and i think it is not enough,
i saw many article about Authentication and Authorization in ASP.NET and i feel they are more advanced than that article for WPF
i want advanced articles ....
Hi MrProgrammer_78

I have to agree with the post from _duDE_. I do not think it is that simple solution provided by Magnus Montin in his article. Magnus is Microsoft MVP which means he has some solid and proven knowledge of .NET technologies. In addition, the article has been reviewed by a Microsoft Partner. For me it means something already.

I do not know what your formal requirements on security are. But I have to tell you that last week I implemented custom authentication and authorization based on the Magnus Montin's article and the article from Elvin Cheng at Code Project (here). You may also browse into the comments to the article where I described how to implement the dynamic authorization.

From your posts above I have the feeling we both are working on similar type of application - more or less standalone application with connection to one or more databases with a security map (user roles vs. access rights) where WPF controls gets hidden/visible or enabled/disabled based on the user's security context. I am working on such application(s) but for different industry. With combining these approaches I successfully implemented and tested the security in my application.

You may browse through the Elvin's article (and maybe Magnus' article again) to reconsider if you still need to stick to implementing several applications instead of just one. My security implementation fit into 12 short classes and 3 database tables (+ some administration/management UI).

Please let me know should you have more questions.

Jiri Novotny
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900