问题标签 [userprincipal]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
wcf - System.ServiceModel:对 SSPI 的调用失败,目标主体名称不正确
我正在尝试访问 WCF 服务端点。但是,每当我尝试访问该服务时,我都会在服务器上不断收到上述异常(当我检查日志时)。
该服务基本上具有相互证书行为。它列出了一个客户端证书和一个服务证书。此外,它在其 web.conf 的 endpoint\identity 部分下指定了一个 userPrincipleName... 类似设置的配置文件示例如下所示...
将是我描述的端点。
这就是服务和行为。
我正在尽我所能尝试从这件事中获取数据。我遇到了一个症结,我不确定是不是因为我走错了路,还是因为我已经很接近了,我只需要克服一点小麻烦。在我的客户端 web.config 中,我类似地设置了端点行为......
这是我的终点...
现在,每当我尝试使用此服务时,我都会收到此异常...
我会注意到,我的本地计算机上列出了相应商店中的证书,并且我已向该证书授予了相应的写入权限。我到了这样的地步,我意识到我在这里给自己制造了更多麻烦,我试图找出正确的做法,而不是把东西扔在墙上,看看有什么东西会粘住。我错过了什么步骤?从 MutualCertificate 安全服务接收数据的最佳方式是什么?我怎样才能最好地获得正确的用户原则名称?我认为这将是服务 web.config 中列出的内容?我是否以正确的方式解决这个问题?我是在接近还是只是为自己制造更大的混乱?
c# - 为 PrincipalContext 指定容器后找不到用户
我试图在 Active Directory 中按用户名查找用户。
这有效:
这不会:
我收到错误消息:
服务器上没有这样的对象。
这是我的 ActiveDirectory 设置的屏幕截图:
我也尝试过使用以下容器:
这同样不成功。
如何在访问“用户”容器时指定我的容器?在引入具有更复杂要求的查找之前,我试图将其作为初始的简单设置。所以,我宁愿不满足于简单的解决方案,因为无论如何我都必须解决这个问题,我相信。
https - 在 SecurityFilter 中调用 getUserPrincipal 导致 IllegalStateException:Handshake is not completed
我只是尝试使用 Jersey 1.16 并在我的应用程序中添加 https 支持。使用Jersey https_grizzly 示例作为参考,我在 SecurityFilter.authority() 中添加了一行代码
然后我尝试使用 https 启动服务器并将 setNeedClientAuth 设置为 false 以避免通过更改 startServer() 中的 Server.java 来使用客户端证书:
setNeedClientAuth(false) 中的布尔参数最初为 true,以便请求客户端证书。我认为通过这种方式,我的应用程序可以适应有证书和没有证书的客户。如果没有证书,getUserPrincipal() 可能会返回 null,以便我知道这是一个匿名用户。不幸的是,在这种情况下,系统引发如下异常并且客户端没有收到任何信息:
为什么在这种情况下我不能使用 getUserPrincipal() ?有人知道吗?谢谢你。
c# - 如何使用 System.DirectoryServices.AccountManagement 命名空间获取 Active Directory 用户属性?
我想从用户那里获取 Active Directory 属性,并且我想使用System.DirectoryServices.AccountManagement
.
我的代码:
asp.net-mvc-4 - MVC4 中与 Active Directory 相关的 AppDomainUnloadedException
我有一个 ASP.NET MVC 应用程序。它在域上运行,我们通过调用来确定用户UserPrincipal.Current
。这在大多数情况下都很有效。每隔一段时间(可能 5 次中就有 1 次),并且只有在我将应用程序发布到 IIS 之后,它才会抛出 AppDomainUnloadedException。
导致异常的代码的特定行是:
调用堆栈的其余部分是:
经过大量挖掘,由于异常的随机性,我得出结论,问题可能与此有关:
http://support.microsoft.com/kb/2683913
所以我安装了修补程序,正如预期的那样,问题消失了。那是星期二。今天早上,异常又开始了。我验证了 hotifx 确实已安装。我打开了模块加载消息并得到:
所以我验证了那个 .dll 实际上是来自修补程序的那个,它是(大小和版本#s 匹配)。
在我得到这个异常的同时,我在事件日志中得到这个事件:
错误中的唯一数据是:0x8007006D,我相信这只是意味着存在致命的通信错误,错误已经说过......
幽默的是,当异常对话框弹出时,它说:“如果有这个异常的处理程序,程序可以安全地继续。” 如果您的应用程序不需要 UserPrincipal.Current,这是正确的,但是在此异常之后再次调用它会导致异常重新抛出,所以我会质疑他们在那里的“安全继续”断言。
现在,如果我重新运行该应用程序,我不会遇到问题。除了发布后,我还没有任何时候发生过这种情况。由于我们的设置和与其他项目的关系,这个应用程序必须在 IIS 下调试,这意味着我每次进行代码更改时都必须发布它,这意味着我通常一整天都看到这个(周二下午和昨天除外) .
我似乎很好奇,从四处挖掘,这个错误似乎经常与 ASP.NET MVC 相关联,但我不相信我已经看到它与 WinForms 或 ASP.NET 相关联......我看不到这有什么关系,但也许那里有关系。
我怀疑这是一个 MS 错误。我无法想象在任何合法条件下 UserPrincipal.Current 会导致 AppDomainUnloadedException,但我想我会在 Stackoverflow 上试一试……
c# - 使用 UserPrincipal SetPassword 方法时访问被拒绝
使用UserPrincipal类更改用户密码时出现AccessDenied异常。
我正在通过Windows Authentication (domain user)登录到 Asp.Net 应用程序。如果我尝试更改其他用户的密码,则会收到拒绝访问异常。如果我对已登录的用户执行相同操作,则一切正常 - 我可以更改密码。
我想,如果我将使用PrincipalContext获取UserPrincipal对象,我将做任何我的 'Principal - domain\adminAD ' 在 AD 中具有特权的事情。
方法体:
我已经搜索过答案,我知道类似主题有很多答案。但他们都没有解释我的问题,我猜。
c# - Getting UserPrincipal with Windows authentication and anonymous authentication on
The following code only works while only Windows Authentication is enabled in IIS for local users on our network.
Otherwise it throws this exception:
[ArgumentException: The (&(objectCategory=user)(objectClass=user)(|(userPrincipalName=)(distinguishedName=)(name=))) search filter is invalid.] System.DirectoryServices.ResultsEnumerator.MoveNext() +434305 System.DirectoryServices.SearchResultCollection.get_InnerList() +282 System.DirectoryServices.SearchResultCollection.get_Count() +9 System.DirectoryServices.AccountManagement.ADStoreCtx.FindPrincipalByIdentRefHelper(Type principalType, String urnScheme, String urnValue, DateTime referenceDate, Boolean useSidHistory) +1898 System.DirectoryServices.AccountManagement.ADStoreCtx.FindPrincipalByIdentRef(Type principalType, String urnScheme, String urnValue, DateTime referenceDate) +85 System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) +211 System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) +95 WebApplication1.Index.GetUserPrincipal(String userName) in C:\Users\xxx\Documents\Visual Studio 2010\Projects\WebApplication1\WebApplication1\Index.aspx.cs:38 WebApplication1.Index.Page_Load(Object sender, EventArgs e) in C:\Users\xxx\Documents\Visual Studio 2010\Projects\WebApplication1\WebApplication1\Index.aspx.cs:19 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064
Is there any way of getting this to work for getting our local users UserPrincipal while Windows and Anonymous authentication are both turned on?
active-directory - 从 Active Directory 获取 EmailAddress NULL (AccountManagement UserPrincipal)
我有一个问题,找不到解决方案:
我有下面的代码来检索正在访问 Web 应用程序的电子邮件 ( EmailAddress
) 用户。
对于某些用户(目前为止三个),电子邮件 ( EmailAddress
) 带有一个空值。
我也尝试了下面的代码,同样的情况发生了:
我怀疑这与 Exchange Server 有关,但我不能说缺乏知识。
任何人都可以帮忙吗?
asp.net - System.DirectoryServices.AccountManagement.Principal.GetGroups 只为某些用户返回一个组“域用户”
下面的代码几周前还在工作,但最近它停止获取许多用户帐户的组,我不知道发生了什么变化。代码没有改变。
该.GetGroups()
方法只返回一个组,域上许多用户的域用户,但对于我的用户和其他几个用户,它确实返回了完整的组集合。
目标只是获取该用户所属的组列表。我对 Active Directory 结构了解不多。