473,387 Members | 1,611 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.

User authentication through web service (follow up)

My app is a .NET forms app that runs in the taskbar and periodically polls a web service. I have a client that wants
the app to integrate with their Active Directory. They do not want the user to have to provide the username and
password to login to the application/web service. I need to be able to send the users authenticated security token to
the web service. I have looked at the UserNameToken class of the WSE 2.0 Security.Tokens namespace but it requires that
you pass it the users password which is not available programatically. Is there a way to send the security context of
the locally logged in user to the web service so that it can authenticate the user to the AD without requiring the user
to enter their username and password into the application?
--Buddy
Nov 23 '05 #1
5 2171
Are we talking about a web service that is 'polled' over the internet or a
web service that is 'polled' over a LAN where the user is already logged in
to the same domain as the web service.

If it is the latter, simply change the web service to allow Windows
Integrated Authentication only and, on the client, add the url of the web
service to the trusted intranet sites.
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl...
My app is a .NET forms app that runs in the taskbar and periodically polls
a web service. I have a client that wants the app to integrate with their
Active Directory. They do not want the user to have to provide the
username and password to login to the application/web service. I need to
be able to send the users authenticated security token to the web service.
I have looked at the UserNameToken class of the WSE 2.0 Security.Tokens
namespace but it requires that you pass it the users password which is not
available programatically. Is there a way to send the security context of
the locally logged in user to the web service so that it can authenticate
the user to the AD without requiring the user to enter their username and
password into the application?
--Buddy

Nov 23 '05 #2
It is the latter (on a LAN). So, if the current client code (which I did not write) has the following in it

proxy.RequestSoapContext.Security.Tokens.Add(new UsernameToken(username, password, PasswordOption.SendHashed));
proxy.RequestSoapContext.Security.Timestamp.TtlInS econds = TimeToLive;

should I remove this? Will the the client then automatically send the local security token (as a UserNameToken)?

--Buddy
Stephany Young wrote:
Are we talking about a web service that is 'polled' over the internet or a
web service that is 'polled' over a LAN where the user is already logged in
to the same domain as the web service.

If it is the latter, simply change the web service to allow Windows
Integrated Authentication only and, on the client, add the url of the web
service to the trusted intranet sites.
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl...
My app is a .NET forms app that runs in the taskbar and periodically polls
a web service. I have a client that wants the app to integrate with their
Active Directory. They do not want the user to have to provide the
username and password to login to the application/web service. I need to
be able to send the users authenticated security token to the web service.
I have looked at the UserNameToken class of the WSE 2.0 Security.Tokens
namespace but it requires that you pass it the users password which is not
available programatically. Is there a way to send the security context of
the locally logged in user to the web service so that it can authenticate
the user to the AD without requiring the user to enter their username and
password into the application?
--Buddy


Nov 23 '05 #3
I'm not sure of the finer nuts and bolts of how it actually does it but what
I am talking about is:

The client PC is joined to a domain
The IIS server is on a member server in the same domain
The current user is logged in to the domain

When the web service and, of course, the hosting web site as configured for
Windows Integrated Security, and the url is registered as a trusted intranet
url then what happens is:

Client uses url to access the web site
Web site asks client for authentication information
Client sends current security token to web site
Web site does whatever it needs to do with this and passes request on to
the web service

No security related code is required in the client application.

You can test this by getting a web method to write all the server variable
and/or session variables out to a file and it will show that the web
site/web service knows all that it needs to know authentication wise.

If the web site is exposed to the internet then it is a different kettle of
fish.
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:ux**************@TK2MSFTNGP10.phx.gbl...
It is the latter (on a LAN). So, if the current client code (which I
did not write) has the following in it

proxy.RequestSoapContext.Security.Tokens.Add(new
UsernameToken(username, password, PasswordOption.SendHashed));
proxy.RequestSoapContext.Security.Timestamp.TtlInS econds = TimeToLive;

should I remove this? Will the the client then automatically send the
local security token (as a UserNameToken)?

--Buddy
Stephany Young wrote:
Are we talking about a web service that is 'polled' over the internet or
a web service that is 'polled' over a LAN where the user is already
logged in to the same domain as the web service.

If it is the latter, simply change the web service to allow Windows
Integrated Authentication only and, on the client, add the url of the web
service to the trusted intranet sites.
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl...
My app is a .NET forms app that runs in the taskbar and periodically
polls a web service. I have a client that wants the app to integrate
with their Active Directory. They do not want the user to have to
provide the username and password to login to the application/web
service. I need to be able to send the users authenticated security
token to the web service. I have looked at the UserNameToken class of the
WSE 2.0 Security.Tokens namespace but it requires that you pass it the
users password which is not available programatically. Is there a way to
send the security context of the locally logged in user to the web
service so that it can authenticate the user to the AD without requiring
the user to enter their username and password into the application?
--Buddy



Nov 23 '05 #4
hmmmmmmmmm....

Somethings not right because I did what you suggest and it doesn't appear to be working and by "doesn't appear" I mean
it isn't working. I'm creating a derived UsernameTokenManager class and overiding the AuthenticateToken method so I can
authenticate the user to my database but I see no activity on my database indicating that it is trying to authenticate
the user.

--Buddy


Stephany Young wrote:
I'm not sure of the finer nuts and bolts of how it actually does it but what
I am talking about is:

The client PC is joined to a domain
The IIS server is on a member server in the same domain
The current user is logged in to the domain

When the web service and, of course, the hosting web site as configured for
Windows Integrated Security, and the url is registered as a trusted intranet
url then what happens is:

Client uses url to access the web site
Web site asks client for authentication information
Client sends current security token to web site
Web site does whatever it needs to do with this and passes request on to
the web service

No security related code is required in the client application.

You can test this by getting a web method to write all the server variable
and/or session variables out to a file and it will show that the web
site/web service knows all that it needs to know authentication wise.

If the web site is exposed to the internet then it is a different kettle of
fish.
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:ux**************@TK2MSFTNGP10.phx.gbl...
It is the latter (on a LAN). So, if the current client code (which I
did not write) has the following in it

proxy.RequestSoapContext.Security.Tokens.Add(new
UsernameToken(username, password, PasswordOption.SendHashed));
proxy.RequestSoapContext.Security.Timestamp.TtlInS econds = TimeToLive;

should I remove this? Will the the client then automatically send the
local security token (as a UserNameToken)?

--Buddy
Stephany Young wrote:
Are we talking about a web service that is 'polled' over the internet or
a web service that is 'polled' over a LAN where the user is already
logged in to the same domain as the web service.

If it is the latter, simply change the web service to allow Windows
Integrated Authentication only and, on the client, add the url of the web
service to the trusted intranet sites.
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl...
My app is a .NET forms app that runs in the taskbar and periodically
polls a web service. I have a client that wants the app to integrate
with their Active Directory. They do not want the user to have to
provide the username and password to login to the application/web
service. I need to be able to send the users authenticated security
token to the web service. I have looked at the UserNameToken class of the
WSE 2.0 Security.Tokens namespace but it requires that you pass it the
users password which is not available programatically. Is there a way to
send the security context of the locally logged in user to the web
service so that it can authenticate the user to the AD without requiring
the user to enter their username and password into the application?
--Buddy

Nov 23 '05 #5
Set a break point in the AuthenticateToken method. If the break point is
not hit (I had this problem before), check:
1) You are actually sending a UT.
2) The token is already cached. In which case the Auth method is not run as
it finds the UT in cache.
3) Related to 2. If client and server is in same AppDomain, I think the UT
is cached when you create it on the client side so the server side "sees" it
cached, hence does not run the Auth method. IIRC, you can get other strange
side effects using the same appdomain. The solution is to break the app
into two projects. A client and a server. Have your default project in the
solution be the server project and start it. Start the client project from
the right-click "Debug/Start new instance" menu command in Solution
explorer. Now you have two processes/appdomains and you should hit your
break point in the Auth method the first time. The next time it will have
been cached and method should not run until the UT expires (see Note).

Note: You can also override CacheSecurityToken() method and just return so
as not cache the UT. That way, the Auth method should run each time. You
can use that for testing to verify things. Normally, you would not override
this method.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:#l**************@TK2MSFTNGP12.phx.gbl...
hmmmmmmmmm....

Somethings not right because I did what you suggest and it doesn't appear to be working and by "doesn't appear" I mean it isn't working. I'm creating a derived UsernameTokenManager class and overiding the AuthenticateToken method so I can authenticate the user to my database but I see no activity on my database indicating that it is trying to authenticate the user.

--Buddy


Stephany Young wrote:
I'm not sure of the finer nuts and bolts of how it actually does it but what I am talking about is:

The client PC is joined to a domain
The IIS server is on a member server in the same domain
The current user is logged in to the domain

When the web service and, of course, the hosting web site as configured for Windows Integrated Security, and the url is registered as a trusted intranet url then what happens is:

Client uses url to access the web site
Web site asks client for authentication information
Client sends current security token to web site
Web site does whatever it needs to do with this and passes request on to the web service

No security related code is required in the client application.

You can test this by getting a web method to write all the server variable and/or session variables out to a file and it will show that the web
site/web service knows all that it needs to know authentication wise.

If the web site is exposed to the internet then it is a different kettle of fish.
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:ux**************@TK2MSFTNGP10.phx.gbl...
It is the latter (on a LAN). So, if the current client code (which I
did not write) has the following in it

proxy.RequestSoapContext.Security.Tokens.Add(new
UsernameToken(username, password, PasswordOption.SendHashed));
proxy.RequestSoapContext.Security.Timestamp.TtlInS econds = TimeToLive;
should I remove this? Will the the client then automatically send the
local security token (as a UserNameToken)?

--Buddy
Stephany Young wrote:

Are we talking about a web service that is 'polled' over the internet ora web service that is 'polled' over a LAN where the user is already
logged in to the same domain as the web service.

If it is the latter, simply change the web service to allow Windows
Integrated Authentication only and, on the client, add the url of the webservice to the trusted intranet sites.
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:Om**************@TK2MSFTNGP14.phx.gbl...
>My app is a .NET forms app that runs in the taskbar and periodically
>polls a web service. I have a client that wants the app to integrate
>with their Active Directory. They do not want the user to have to
>provide the username and password to login to the application/web
>service. I need to be able to send the users authenticated security
>token to the web service. I have looked at the UserNameToken class of the>WSE 2.0 Security.Tokens namespace but it requires that you pass it the
>users password which is not available programatically. Is there a way to>send the security context of the locally logged in user to the web
>service so that it can authenticate the user to the AD without requiring>the user to enter their username and password into the application?
>
>
>--Buddy


Nov 23 '05 #6

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

Similar topics

4
by: Dan Higman | last post by:
I'm sure this is easy and I'll be embarrassed when I see the answer, but I just can't figure this one out. Using .Net/ASP 1.1 on a server using integrated authentication-- I have a web page...
4
by: pjdouillard | last post by:
Hello all, Here is the context of my problem: We have an ASP.NET 1.1 application that has its own application pool setup and that runs under the identity of a NT Domain service account (this...
3
by: Asaf | last post by:
Hello, I have created a web service name "TestWS" and published it to my SBS2003 server that uses IIS6 as a web server. I have set NO anonymous access to TestWS virtual directory and I have...
9
by: webrod | last post by:
Hi all, how can I check a user/password in a LDAP ? I don't want to connect with this user, I would like to connect to LDAP with a ADMIN_LOG/ADMIN_PWD, then do a query to find the user and...
3
by: =?Utf-8?B?TWFyY0c=?= | last post by:
I have a Server.Transfer in my asp:Login LoggedIn event handler. I am forcing transfer to a specific page since I do not want to use the ReturnURL that is in Request.Params (i.e., the user...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
3
by: =?Utf-8?B?QXhlbCBEYWhtZW4=?= | last post by:
Hi, we've got a strange problem here: We've created an ASP.NET 2.0 web application using Membership.ValidateUser() to manually authenticate users with our website. The problem is: If the...
3
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I want to limit the user only login the system one time at the same time. I don't want him login the system two with the same user at the same time. How to do this? If i have a table to record...
4
by: Brett | last post by:
I have an ASP.NET 2.0 application that uses Forms Authentication. The startup page contains just a login control, and the site works well on an IIS 6 web server. I am now setting the site up on...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...

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.