Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Is it authenticated domain user?

Posted on 2004-10-04
8
Medium Priority
?
306 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 252 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
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 248 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

916 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