Re: Authorizing users based on User Groups
From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 08/27/03
- Next message: Joe Kaplan \(MVP - ADSI\): "Re: ASPNET Event Log Access"
- Previous message: Ivan Medvedev [MS]: "Re: DESCryptoServiceProvider weak and semi-weak keys [ADDITION]"
- In reply to: Edwin: "Re: Authorizing users based on User Groups"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 27 Aug 2003 12:16:48 -0500
It still can. In a Win32 application, you get the current principal by
calling System.Threading.Thread.CurrentPrincipal. This can return to you a
WindowsPrincipal that will contain the token and groups of the current
logged on user.
However, you need to do a little bit more work to get this to work because
by default Windows apps don't set the IPrincipal on each thread. To get
that to happen, you need to set the PrincipalPolicy on the current AppDomain
to PrincipalPolicy.WindowsPrincipal. You should be able to do that with:
AppDomain.Current.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
However, you need the appropriate CAS SecurityPermission (with
ControlPrincipal flag) to set the AppDomain's PrincipalPolicy (see the docs
for more details). Generally you will have this if the app is installed
locally (you will have FullTrust), but if it is run from a network share or
downloaded, you may not by default.
HTH,
Joe K.
"Edwin" <Edwin.Loubser@comau.co.za> wrote in message
news:07df01c36c74$3bc5f0e0$a601280a@phx.gbl...
> Ok but this is a normal Windows 32 application, the user
> is not authenticated via IIS. Will this information still
> be available?
>
> Thanx
- Next message: Joe Kaplan \(MVP - ADSI\): "Re: ASPNET Event Log Access"
- Previous message: Ivan Medvedev [MS]: "Re: DESCryptoServiceProvider weak and semi-weak keys [ADDITION]"
- In reply to: Edwin: "Re: Authorizing users based on User Groups"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|