在我的 Windows Server 2016 上,我试图找出运行命令语法以在我的 ldap 中以用户身份运行 docker 映像。我读了这篇文章,但我没有很好地遵循它(不同的环境)
也许我想念对这个概念的理解,但最终我需要在我们的活动目录中以特定用户的身份运行容器。
任何指向有据可查的运行的链接——用户示例将不胜感激......
令人困惑的事情之一是试图找出 UserId 等......
我正在将身份验证过程转换为支持异步,VS 2015 IDE 警告我以下消息: 异步方法缺少“等待”运算符并将同步运行...等等...
不管怎样,代码连接到 LDAP 存储并验证用户的帐户等等...我已经尝试过使用 wait 进行各种操作,但我只是在这里遗漏了一些东西。我将代码恢复到之前的状态。我将不胜感激任何有关使其正确支持异步的指导...
这是代码:
public async Task<User> GetAsyncADUser(PrincipalContextParameter param)
{
try
{
if (UseLDAPForIdentityServer3)
{
using (var pc = new PrincipalContext(ContextType.Domain, param.ADDomain, param.ADServerContainer, param.ADServerUser, param.ADServerUserPwd))
{
UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(pc, param.UserNameToValidate);
if (userPrincipal != null)
{
bool isvalid = pc.ValidateCredentials(userPrincipal.DistinguishedName, param.UserPasswordToValidate, ContextOptions.SimpleBind);
if (isvalid)
{
User user = new User { ad_guid = userPrincipal.Guid.ToString(), Username = param.UserNameToValidate, Password = param.UserPasswordToValidate };
return user;
}
}
}
}
}
catch (Exception ex)
{ …Run Code Online (Sandbox Code Playgroud)