PC Review


Reply
Thread Tools Rate Thread

ClickOnce and login on as a different user

 
 
Anders K. Olsen
Guest
Posts: n/a
 
      12th Jul 2006
Hello group

I'm developing an C# Windows Forms application that I would like to deploy
using ClickOnce.

One of the computers that the application is deployed on, is a computer that
is always loged on as a generic "controlroom" user. This is necessary for
some of the other applications running on the computer.

On my application, the user should always logon as himself or herself.
Therefore I need to present a login form to the user as the first thing.

I have been considering using RunAs, but I'm not sure that is possible along
with ClickOnce, at least nok using the GUI of RunAs.

I have looked at the Windows API LogonUser, but that seems to be requiring
unsafe code permissions and FullTrust, and I was hoping that I could avoid
giving those permissions to the application, especially when I'm deploying
it using ClickOnce.

Do you have any alternative suggestions?

Thank you for your answer.

Regards
Anders Olsen


 
Reply With Quote
 
 
 
 
Steve B.
Guest
Posts: n/a
 
      12th Jul 2006
Do you really need authenticate against local computer ?
If your application will use a remote server (Web service, DB or anything),
you can try to authenticate against this service to check if the user can
access to the application...

Steve

"Anders K. Olsen" <(E-Mail Removed)> a écrit dans le message de news:
%(E-Mail Removed)...
> Hello group
>
> I'm developing an C# Windows Forms application that I would like to deploy
> using ClickOnce.
>
> One of the computers that the application is deployed on, is a computer
> that is always loged on as a generic "controlroom" user. This is necessary
> for some of the other applications running on the computer.
>
> On my application, the user should always logon as himself or herself.
> Therefore I need to present a login form to the user as the first thing.
>
> I have been considering using RunAs, but I'm not sure that is possible
> along with ClickOnce, at least nok using the GUI of RunAs.
>
> I have looked at the Windows API LogonUser, but that seems to be requiring
> unsafe code permissions and FullTrust, and I was hoping that I could avoid
> giving those permissions to the application, especially when I'm deploying
> it using ClickOnce.
>
> Do you have any alternative suggestions?
>
> Thank you for your answer.
>
> Regards
> Anders Olsen
>



 
Reply With Quote
 
Anders K. Olsen
Guest
Posts: n/a
 
      13th Jul 2006
"Steve B." <(E-Mail Removed)_swap_msn_and_com> wrote in message
news:%23vHI$(E-Mail Removed)...
> Do you really need authenticate against local computer ?
> If your application will use a remote server (Web service, DB or
> anything), you can try to authenticate against this service to check if
> the user can access to the application...


Hello Steve

Thank you for your answer.

I have been thinking about this. My application will have a server, and I
could do the authentication on the server. However, I would like to run my
client application as the correct user, so I would like to impersonate this
user even though the actual windows user is the "controlroom" user.

My reason for this is that I would like to call my web service methods as
the correct windows user, and use Windows build in authentication and
authorization on both the server and the client.

I don't know that much about impersonation, so I don't know if this is even
possible. My idea was that the first thing that happends is that the user is
authenticated and then the I would set Thread.CurrentPrincipal to a
WindowsPrincipal corresponding to the correct user (not the "controlroom"
user). It was my hope that the rest of the application would then run as the
correct user. I'm not sure if this is correct, e.g. if new threads will also
run as the correct user, or if threadpool threads will also run as the
correct user.

Regards
Anders


 
Reply With Quote
 
Robbe Morris [C# MVP]
Guest
Posts: n/a
 
      16th Jul 2006
Forcing your server to be apart of the same active directory
domain (your users would be authenticated against their
windows accounts)?

Are you sure that is a good long term configuration?

What happens when the system admin folks want
to isolate your production servers from windows
account holders altogether?

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp





"Anders K. Olsen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Steve B." <(E-Mail Removed)_swap_msn_and_com> wrote in message
> news:%23vHI$(E-Mail Removed)...
>> Do you really need authenticate against local computer ?
>> If your application will use a remote server (Web service, DB or
>> anything), you can try to authenticate against this service to check if
>> the user can access to the application...

>
> Hello Steve
>
> Thank you for your answer.
>
> I have been thinking about this. My application will have a server, and I
> could do the authentication on the server. However, I would like to run my
> client application as the correct user, so I would like to impersonate
> this user even though the actual windows user is the "controlroom" user.
>
> My reason for this is that I would like to call my web service methods as
> the correct windows user, and use Windows build in authentication and
> authorization on both the server and the client.
>
> I don't know that much about impersonation, so I don't know if this is
> even possible. My idea was that the first thing that happends is that the
> user is authenticated and then the I would set Thread.CurrentPrincipal to
> a WindowsPrincipal corresponding to the correct user (not the
> "controlroom" user). It was my hope that the rest of the application would
> then run as the correct user. I'm not sure if this is correct, e.g. if new
> threads will also run as the correct user, or if threadpool threads will
> also run as the correct user.
>
> Regards
> Anders
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot open user default database. Login failed. Login failed for user 'HEMPC\ASPNET' Tony Johansson Microsoft ASP .NET 3 2nd Jan 2010 04:09 PM
ClickOnce and user agent string goHawkeyes Microsoft Dot NET Framework Forms 0 6th Feb 2008 07:35 PM
ClickOnce without user confimation Mathias Fritsch Microsoft Dot NET Framework Forms 10 8th Jan 2008 05:06 PM
ClickOnce & user accessibility? Lloyd Dupont Microsoft Dot NET Framework 2 18th Jul 2005 03:08 AM
Cannot open database requested in login ''. Login fails. Login failed for user ''. Nevena Microsoft ADO .NET 1 16th Apr 2004 06:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:17 PM.