Solved

Is it authenticated domain user?

Posted on 2004-10-04
8
301 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
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 …
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 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