Re: Impersonation

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bradford Ray (nospam_at_hotmail.com)
Date: 09/24/04


Date: Fri, 24 Sep 2004 14:37:01 +0100

Hi Jay, thanks for looking at my post!

Yes, the admin impersonation took place in a web part. The impersonation
seems to work, and windows knows there is a 'new' user, but Sharepoint
doesn't? (The login box only appears when I try to do anything with
Sharepoint)

I have also tried changing the HttpContext and using it to get an SPWeb
object, but it still doesn't see the impersonated user.

Any ideas?

"JNathan" <jay.nathan@mariner-usa.com> wrote in message
news:bb7f1799.0409240408.7b24b2e@posting.google.com...
> The SharePoint object model still isn't aware of the context change,
> and to me, this is almost a shortcoming of the SharePoint object model
> (but there may be a compelling reason that it is this way). When you
> say that you have successfully impersonated the admin user and created
> local accounts, did you do that within a Web Part in SharePoint?
>
>
>
> "Bradford Ray" <nospam@hotmail.com> wrote in message
news:<#R4Io1jmEHA.3756@TK2MSFTNGP09.phx.gbl>...
> > Update: I have just successfully Impersonated the administrator to
create
> > local windows accounts using DirectoryServices, so I know the
Impersonation
> > works on some level...
> >
> > It seems Sharepoint isn't being updated with the new user information?
> >
> >
> >
> > "Bradford Ray" <nospam@hotmail.com> wrote in message
> > news:%23UcNCTjmEHA.3876@TK2MSFTNGP15.phx.gbl...
> > > Hi,
> > >
> > > I'm having an identity crisis. I am using Jay Nathan's Impersonator
class
> > to
> > > try impersonate an administrator, which seems to be working except
that
> > > Sharepoint doesn't know that the user has changed.
> > >
> > > To try explain what I mean, this is what gets returned AFTER I call
> > > .Impersonate():
> > > System.Security.Principal.WindowsIdentity.GetCurrent.Name returns the
> > > adminstrator;
> > > Environment.UserName returns the administrator;
> > > Initially context.User.Identity.Name is incorrect, but then if I set
the
> > > context.User to use the new Identity (with New ...GenericPrincipal),
it
> > > shows the User to be the administrator;
> > > SPControl.GetContextWeb(context).CurrentUser.LoginName stills shows
the
> > > non-administrative user (I call this after I have changed the context
> > > object);
> > >
> > > I am not sure if any of those is significant (for all I know the
SPUser
> > > shouldn't change), but what I do know is that when a "Reader" user
runs my
> > > code they get a login box because of insufficient permissions. The
login
> > > shows when I call .Update() on a restricted SPListItem - commenting
out
> > that
> > > line doesn't bring up a login box, so I'm sure the Impersonation isn't
> > > throwing errors.
> > >
> > > Our site is in test, so I've changed the web.config's trust level to
Full
> > > which means I haven't made any changes to any Sharepoint
...trust.config
> > > files.
> > >
> > > Basically, any ideas? From what I've seen I'm not doing anything too
> > > differently from Jay Nathans stuff, or even from MSDN's event handler
> > > example which also uses Impersonation.
> > >
> > > Cheers,
> > > Brad.
> > >
> > >



Relevant Pages

  • Re: User Impersonate error
    ... > the sharepoint SDK under 'Handling document library events'. ... > property is still set to the user before the impersonation occured? ... After playing around with sharepoint permissions and masking I ... To get this working I initially placed a full rights mask on the whole ...
    (microsoft.public.sharepoint.portalserver.development)
  • RE: Security issue while creating a Personal View programmatically
    ... For an easy approqach to impersonation, ... Microsoft FrontPage MVP ... > creates a personal view through sharepoint then this ... > public static string GetSearchView ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Going from anonymous security to Windows Security in an ASP.NET application
    ... "integrate" a public website, with a Windows Authenticated website, where we ... impersonation, which takes place on the server has no effect on page ... them sharepoint information, etc. e.g. from this point on their web ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Get a list of all top level WSS sites in SPS?
    ... you'll have to do extended impersonation as you're going into an area of the object model that regular impersonation can't do. ... I agree SharePoint navigation can be improved but it'll never satisfy everyone's needs. ... level WSS or Team Sites. ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Web Part development pops up a logon screen and gives no acces
    ... account (and other developers acct). ... > and then use impersonation to "switch" them to a regular sharepoint ...
    (microsoft.public.sharepoint.portalserver.development)