Print Page | Close Window |
Windows Authentication & LoginViewModel Printed From: IdeaBlade Category: Cocktail Forum Name: Community Forum Forum Discription: A professional application framework using Caliburn.Micro and DevForce URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3551 Printed Date: 26-Apr-2024 at 12:15am Topic: Windows Authentication & LoginViewModel Posted By: jlozina Subject: Windows Authentication & LoginViewModel Date Posted: 23-Jul-2012 at 5:39am
Replies: Posted By: mgood Date Posted: 23-Jul-2012 at 9:31am
Posted By: jlozina Date Posted: 24-Jul-2012 at 6:27am
Posted By: mgood Date Posted: 24-Jul-2012 at 9:04am
You must also enable http://drc.ideablade.com/ApiDocumentation/webframe.html?IdeaBlade.EntityModel.Web~IdeaBlade.EntityModel.Web.AspAuthenticatingLoginManager~AspNetCompatibilityEnabled.html - |
You must enable the ASP.NET services you wish to use in the system.web configuration section of the config file, as well as choose the type of authentication wanted. These steps are described below.
This is for a WPF application. Are the instructions above for WPF or Silverlight? |
They are for both, but in case of WPF, they only apply to an n-tier IIS deployment as in order to use ASP.NET security you need to deploy the EntityServer to IIS. If you are building a 2-tier WPF application or run the EntityServer from the command line or as a Windows service, then you have to implement your own LoginManager that grabs the WindowsPrincipal upon login. The following shows how you can accomplish this in a 2-tier application. You can adapt the code accordingly for the other two scenarios. public class AppBootstrapper : FrameworkBootstrapper<MainViewModel> { private IAuthenticationService _authenticationService; static AppBootstrapper() { AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); } protected override void PrepareCompositionContainer(CompositionBatch batch) { base.PrepareCompositionContainer(batch); batch.AddExportedValue(_authenticationService = new AuthenticationService()); } protected override void StartRuntime() { base.StartRuntime(); _authenticationService.Login(null); } } public class WindowsLoginManager : IEntityLoginManager { #region IEntityLoginManager Members public IPrincipal Login(ILoginCredential credential, EntityManager entityManager) { return Thread.CurrentPrincipal; } public void Logout(IPrincipal principal, EntityManager entityManager) { } #endregion } |
Print Page | Close Window
|