Questuon of CSLA Authentication on Web and Window

Questuon of CSLA Authentication on Web and Window

Old forum URL: forums.lhotka.net/forums/t/1455.aspx


Brian Tian posted on Wednesday, October 11, 2006

Hi, All,

I use CSLA authentication for a window application. When people try to access the winApp, the user's  activeDiectory name System.Security.Principal.WindowsIdentity.GetCurrent().Name will be used as parameter to pass to login() to check the Authentication. (we don't have the login form)  In the dataPortal part of business logic layer, I directly use “Csla.ApplicationContext.User.Identity.Name” at stored procedure for the create_user. It looks like

cm.Parameters.AddWithValue("@user_name", Csla.ApplicationContext.User.Identity.Name);

it works for my WinApp.I only need to checklogin once and Csla.ApplicationContext.User.Identity.Name will keep the userName

 But I have the problem on my web application to use the same business objects. The Csla.ApplicationContext.User.Identity.Name won’t give me the user name (ASPNET or domain\actDirName), it will give me the empty string. I can get the userName at the Web UI, so,  the only way I could solve this is to pass the userName to my dataPortal layer for my WebApp. Is this the right way to do it? is there a better solution?

Thanks

Brian

Brent replied on Wednesday, October 11, 2006

Are you using the global.asax like the PTWeb project does in the Project Tracker solution?

xal replied on Wednesday, October 11, 2006

You could have two Login methods in you proncipal, one that takes a username param an one that doesn't. The second one passes the win identity name to the first one, and that's pretty much it, but you probably want a password for web too, so maybe you need different dp methods. You probably need to specify a bit more what your requirement is.

Andrés

Brian Tian replied on Thursday, October 12, 2006

Thanks for Brent and Andres' help. It works now.

 

Copyright (c) Marimer LLC