How to translate or query SAM account name of user using UPN name from credential provider when domain is offline.

  • Thread starter Thread starter InterGalaticAvenger
  • Start date Start date
I

InterGalaticAvenger

Guest
I am writing a credential provider in Windows and I am trying to add UPN name login support to it and doing so I used TranslateNameW which gives me SAM account name when provided with UPN name and vice versa and this works only when domain is online and won't work when domain is offline.

TranslateNameW(UPName, NameUserPrincipal, NameSamCompatible, buffer, &size);

which gives me SAM account name when provided with UPN name and vice versa and this works only when domain is online and won't work when domain is offline.

The problem here is when the domain user is cached and when domain is offline I am not able to convert that UPN to SAM name and then windows is throwing me an error saying "We can't sign you in with this credential because your domain isn't available. Make sure your device is connected to your organisation's network and try again if you previously signed on this device with another credential you can sign in with that credential." Windows password credential works just fine in this scenario it is able to translate UPN to SAM even when the domain is offline.

I can't parse the UPN name and convert it into SAM name cause it is not guaranteed that UPN name always matches with SAM name i.e if UPN is `johndoe@example.com` SAM Name need not necessarily be `johndoe` it can be `jdoe` or anything.

So, my question is how can I access SAM account name of that cached domain user when domain is offline, Is there any function in VC++ that returns SAM name when provided with UPN when the domain is offline? How can I handle this scenario?

Continue reading...
 
Back
Top