473,387 Members | 1,528 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,387 software developers and data experts.

Sending the WindowsPrincipal object

I am writing a webService that is going to be accessed anonymously (I don't
want to "configurable" depend on windows integrated authentication). But I
still want to authenticate the client (or rather the user using the client).

Because of this I want to send the WindowsPrincipal from the client to the
webService in the SoapHeader. I don't want to send the credentials (userName,
password and domain) because I want the client to be unaware of what account
it runs at and since there may be several client applications (UIF
applications, not ASP.Net applications) I don't want to make the user logon
into each UIF.

The idea is to let user logon to his/her computer and start the UIF
applications. This client app (consumer of webService) gets the current
WindowsPrincipal, serializes it (into a byte array using the BnaryFormatter),
encrypts it and sends it to the webService. The webService in turn decrypts
the message, deserialize the WindowsPrincipal and impersonates it.

That's the idea, and it is quite successfull up until the point where I try
to deserialize the WindowsPrincipal. It throws an exception saying "Invalid
token : it cannot be duplicated".

Obviously it is possible to send the WindowsPrincipal since Windows
Integrated Authentication does just that. So, is there a trick to
(de)serialization that I'm unaware of or is this object just not sendable by
anyone not in access of Microsoft specific mechanisms in the OS or the .Net
framework?
Nov 21 '05 #1
1 3850
Hello Johan,

First of all it's not possible to send a WindowsPrincipal object accross machines. A principal is a local object.

What you could do though is to use Integrated Security with IIS. (you configure the current credentials on the WS proxy.)

Then Windows will take care of it for you. You can enable impersonation in ASP.NET as well.

Best of luck,

Morty
I am writing a webService that is going to be accessed anonymously (I
don't want to "configurable" depend on windows integrated
authentication). But I still want to authenticate the client (or
rather the user using the client).

Because of this I want to send the WindowsPrincipal from the client to
the webService in the SoapHeader. I don't want to send the
credentials (userName, password and domain) because I want the client
to be unaware of what account it runs at and since there may be
several client applications (UIF applications, not ASP.Net
applications) I don't want to make the user logon into each UIF.

The idea is to let user logon to his/her computer and start the UIF
applications. This client app (consumer of webService) gets the
current WindowsPrincipal, serializes it (into a byte array using the
BnaryFormatter), encrypts it and sends it to the webService. The
webService in turn decrypts the message, deserialize the
WindowsPrincipal and impersonates it.

That's the idea, and it is quite successfull up until the point where
I try to deserialize the WindowsPrincipal. It throws an exception
saying "Invalid token : it cannot be duplicated".

Obviously it is possible to send the WindowsPrincipal since Windows
Integrated Authentication does just that. So, is there a trick to
(de)serialization that I'm unaware of or is this object just not
sendable by anyone not in access of Microsoft specific mechanisms in
the OS or the .Net framework?


Nov 21 '05 #2

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

Similar topics

0
by: Alek Davis | last post by:
Hello, I noticed an interesting problem. When calling WindowsPrincipal.IsInRole over dial-up (VPN), this function takes 1-2 minute(s) to return. On the intranet or when disconnected from the...
0
by: Dan Kelley | last post by:
I receive multiple (handled) ArgumentExceptions when I call WindowsPrinciple.IsInRole. The exception text is: A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll...
3
by: Kevin Burton | last post by:
This is more of a solution that raised a question. I have a Web service that does not allow anonymous users. For debugging I put in the following lines in my Web Service: WindowsIdentity wi =...
0
by: Mark | last post by:
Hello Friends Please check following Code Dim x As System.Security.Principal.WindowsPrincipal x = System.Threading.Thread.CurrentPrincipal Response.Write...
2
by: Terry Olsen | last post by:
I have administrator access on 2 different domains on the network at my job. I wrote a program to query the registry key on remote PC's and return the results to an excel spreadsheet. However, the...
7
by: Ray Booysen | last post by:
Hi all I'm sending email via ASP.NET in HTML mode. Each email has exactly one attachment and I do have full access to the SMTP server. However, if I send the email in HTML format, the...
0
by: wk6pack | last post by:
Hi, I'm trying to get my application to authenticate using role based when the user runs the application. When the user logs on and is in the security group "school", the user gets into the...
1
by: =?Utf-8?B?RjVGNUY1?= | last post by:
I use the following function to ascertain if the current user is in ann AD security group. It appears to work, except if the group contains any space characters, it always returns false. For...
1
by: Andy | last post by:
Hi, I currently have my application setup and built using Windows Authentication (WindowsPrincipal). For security checks, I simply do an IsInRole call on the Principal. The role permissions...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.