Note: This expands on the code created in my previous post: Implementing Attribute Based Domain Validation In a WPF MVVM Application
* Download Complete Source Code
Continuing on my WPF MVVM Adventures... My next task was to implement security on my composite application. Unfortunately, as is all to often the case, there where still business decisions to be made concerning the granularity of the security {is field level required} and also the source of record {LDAP, roll-our-own}. Not wanting to loose focus on the security piece and knowing I couldn’t sit around and do nothing I decided to tackle the one piece I knew that was constant…I was going to need a UI for logging in a user.
I started this process by creating a simple/standard log on window.
Now I have my Log On window but it doesn’t do anything. I need to tell my application to show that window first. Your first thought would be to go into the project properties and set LogOn as the startup object, but once you got in there you would notice that there is currently no startup object defined and this is by design. Currently, because we are working with a composite application, all of that is handles by our Bootstrapper which is kicked off from App.xaml in the OnStartUp event.
We need to modify App.xaml.cs to:
That’s it, now we are requiring logging in to our application. You may notice that there are bits in there that we haven’t covered yet, AuthenticationContext etc., this was me planning for the actual authentication implementation and can be replaced with whatever code you need.
Stay tuned for the actual security implementation.
Remember Me
a@href@title, strike
Keith is a Senior Software Engineer with Falafel Software. He has been developing software since 1999 specializing in web-based solutions primarily using the Microsoft stack. He has been a Microsoft MVP in ASP.NET since 2012. (more...)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.