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 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 the domain is online and won't work when the domain is offline.

The problem here is when the domain user is cached and when the 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 provider 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 [email protected] 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 the 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?

0

There are 0 answers