1

I know almost nothing about Active Directory so pardon me if this question seems silly. I have been hired as a remote developer for a project. The application on which I suppose to work relies on Active Directory authentication.

As I am not part of their domain, I can't get logged in through normal channels and getting LDAP server is not available exception.

The code that is throwing this error is

 var context = new PrincipalContext(ContextType.Domain);
 var user = UserPrincipal(context, "some user name");

I need to know if there is a way I could mock this behavior only to get past this code, of course, I won't commit it but only to work on other screens. It is a WinForms application.

They have added me to domain, given me credentials and I create a new user in my windows 10 with those credentials using azure devops. Also got config for vpn from them and got connected to it. Still same error that LDAP server is not available.

Any suggestions to make it work in a correct way or dirty way.

Manvinder
  • 4,495
  • 16
  • 53
  • 100
  • If the software demands you be in the domain, then they should add you there and you should probably work through a VPN? If they use it for login, I guess they also depend on it for rights-management (who can do what). – Fildor Oct 25 '18 at 12:39
  • @Fildor Updated question with some details as you suggested. Still getting LDAP server is not available while trying to create new PrincipalContext. Any suggestions – Manvinder Oct 25 '18 at 16:01

1 Answers1

0

It depends. You could do this, which will make it look at a local user (that exists only on your computer):

var context = new PrincipalContext(ContextType.Machine);
var user = UserPrincipal(context, "some local user name");

But it depends on how user is used later. If it's looking for properties of it that only exist in Active Directory and not local accounts, then it may explode.

Gabriel Luci
  • 38,328
  • 4
  • 55
  • 84