Solved

Is it authenticated domain user?

Posted on 2004-10-04
8
299 Views
Last Modified: 2013-12-03
Hi,

I have a token (hAccessToken) belonged to a current user:

::OpenThreadToken(::GetCurrentThread(), TOKEN_QUERY, TRUE, &hAccessToken));

Is it possible to determine whether a user is authenticated in domain or not? How?
0
Comment
Question by:NetwrkGuru
  • 2
  • 2
  • 2
8 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 12218453
The easy way is: Compare the value of the "USERDOMAIN" env. variable to the local computer name. If they're identical, you have a local logon. The hard way: Use 'LsaQueryInformationPolicy()' as described in http://win32.mvps.org/lsa/lqip2.html
0
 

Author Comment

by:NetwrkGuru
ID: 12218972
I can't obtain "USERDOMAIN" because my code will work on the other machine using DCOM protocal. I have only security token.
0
 
LVL 86

Accepted Solution

by:
jkr earned 63 total points
ID: 12219020
Then you'll have to go the hard way. Get the Token's UserSID and use the code at http://win32.mvps.org/lsa/lsa_lqip2.cpp
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:Milind00
ID: 12234646
When ever you get an access token, it is always after autheticaion. The user is already authenticated in your case.  Why do you want to check this again?
0
 

Author Comment

by:NetwrkGuru
ID: 12234944
User can be authenticated within workgroup or within domain. I want know exactly that user is authenticated within domain.

Code at http://win32.mvps.org/lsa/lsa_lqip2.cpp works only for workstations. The question is still open.
0
 
LVL 4

Assisted Solution

by:Milind00
Milind00 earned 62 total points
ID: 12237625
http://win32.mvps.org/lsa/lsa_lqip2.cpp  this code only tells you that where the machine is. By this you will not know if the user is logged on to machine or domain. The user could be a domain user or machine local user. You can use GetTokenInformation by specifying  " TokenUser" and get the SID of the user. And from the SID you can seperate out RID. Remainig will be domain SID or machine SID. You can verify that.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now