Solved

Is it authenticated domain user?

Posted on 2004-10-04
8
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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 shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

628 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