473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Call function under different security context

Is there a way in .Net to call a function or web service
under a different security context as the one that the
user is logged into?

For example, if a user calls web service 1 (WS1), WS1 is
now running under the user's security context. Is there a
way for WS1 to call another web service, WS2, but to
impersonate a totally different user account for the call?
Nov 15 '05 #1
3 5535
john,

It depends on the mechanism that is used to authenticate the user on the
remote web service. If it is using a windows challenge/response mechanism,
then you will have to change the current user to be the one that you want to
impersonate. If it is just using basic authentication, then you can just
set those parameters in the call, and you would not have to change the
current user that the process is running under.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"john" <jo**@john.com> wrote in message
news:23****************************@phx.gbl...
Is there a way in .Net to call a function or web service
under a different security context as the one that the
user is logged into?

For example, if a user calls web service 1 (WS1), WS1 is
now running under the user's security context. Is there a
way for WS1 to call another web service, WS2, but to
impersonate a totally different user account for the call?

Nov 15 '05 #2
John,

Take a look at the documentation for the Impersonate method on the
WindowsIdentity class. It will detail how you can use a call to the
LoginUser API function through the P/Invoke layer to get a handle to a user
that you can impersonate.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"john" <jo**@john.com> wrote in message
news:22****************************@phx.gbl...
the second WS would use NT authentication to check for
access. I dont want the user calling WS1 to have rights
to WS2, but i want WS1 to call WS2 and impersonate a new
user account. How would i go about doing this?
-----Original Message-----
john,

It depends on the mechanism that is used to

authenticate the user on the
remote web service. If it is using a windows

challenge/response mechanism,
then you will have to change the current user to be the

one that you want to
impersonate. If it is just using basic authentication,

then you can just
set those parameters in the call, and you would not have

to change the
current user that the process is running under.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"john" <jo**@john.com> wrote in message
news:23****************************@phx.gbl...
Is there a way in .Net to call a function or web service
under a different security context as the one that the
user is logged into?

For example, if a user calls web service 1 (WS1), WS1 is
now running under the user's security context. Is there a way for WS1 to call another web service, WS2, but to
impersonate a totally different user account for the

call?


.

Nov 15 '05 #3
Perfect! Thanks
-----Original Message-----
John,

Take a look at the documentation for the Impersonate method on theWindowsIdentity class. It will detail how you can use a call to theLoginUser API function through the P/Invoke layer to get a handle to a userthat you can impersonate.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"john" <jo**@john.com> wrote in message
news:22****************************@phx.gbl...
the second WS would use NT authentication to check for
access. I dont want the user calling WS1 to have rights
to WS2, but i want WS1 to call WS2 and impersonate a new
user account. How would i go about doing this?
>-----Original Message-----
>john,
>
> It depends on the mechanism that is used to

authenticate the user on the
>remote web service. If it is using a windows

challenge/response mechanism,
>then you will have to change the current user to be the

one that you want to
>impersonate. If it is just using basic authentication,

then you can just
>set those parameters in the call, and you would not have
to change the
>current user that the process is running under.
>
> Hope this helps.
>
>
>--
> - Nicholas Paldino [.NET/C# MVP]
> - ni**************@exisconsulting.com
>
>"john" <jo**@john.com> wrote in message
>news:23****************************@phx.gbl...
>> Is there a way in .Net to call a function or web

service >> under a different security context as the one that the >> user is logged into?
>>
>> For example, if a user calls web service 1 (WS1), WS1 is >> now running under the user's security context. Is

there a
>> way for WS1 to call another web service, WS2, but to
>> impersonate a totally different user account for the

call?
>
>
>.
>

.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Adam Warner | last post by:
Hello all, I'm very new to C but I have a number of years of Common Lisp programming experience. I'm trying to figure out ways of translating higher order concepts such as closures into C. The...
46
by: TTroy | last post by:
Hi, I'm just wondering why people/books/experts say "the function returns a pointer to.." or "we have to send scanf a pointer to.." instead of "the function returns the address of.." or "we have...
3
by: Cong Wang | last post by:
Hi,all! I found an interesting problem,it is that how to implement a C function which can be called once and return twice? Just like the POSIX function fork() or the library function...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
5
by: AAguiar | last post by:
I have an asp.net project where the code behind the aspx page calls a c# class which makes calls to a managed static C++ class. The C# class works fine when the asp net worker process starts, when...
3
by: DS | last post by:
I try to generate a excel workbook using Excel object in ASP.NET program. When I implement the Excel workbook generation with out a thread it works fine. When I wrap all the excel generation...
5
by: cooltoriz | last post by:
Hello there, I am not asking how to impersonate a process within C# windows application. I already know that, in C# v2.0, you can easily achieve it using ProcessStartInfo. You can run a process...
11
by: Felix Kater | last post by:
Hi, I can compile and run this code (see below) which twice calls the function f, first with too less, second with too much arguments. But is it legal and free of memory leaks and other...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.