我有一个MVC站点,允许使用Forms登录和Windows身份验证登录.我使用自定义MembershipProvider对Active Directory进行身份验证,使用System.Web.Helpers AntiForgery类进行CSRF保护,以及Owin cookie身份验证中间件.
在登录期间,一旦用户通过了针对Active Directory的身份验证,我将执行以下操作:
IAuthenticationManager authenticationManager = HttpContext.Current.GetOwinContext().Authentication;
authenticationManager.SignOut(StringConstants.ApplicationCookie);
var identity = new ClaimsIdentity(StringConstants.ApplicationCookie,
ClaimsIdentity.DefaultNameClaimType,
ClaimsIdentity.DefaultRoleClaimType);
if(HttpContext.Current.User.Identity is WindowsIdentity)
{
identity.AddClaims(((WindowsIdentity)HttpContext.Current.User.Identity).Claims);
}
else
{
identity.AddClaim(new Claim(ClaimTypes.Name, userData.Name));
}
identity.AddClaim(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "Active Directory"));
identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userData.userGuid));
authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = false }, identity);
Run Code Online (Sandbox Code Playgroud)
我的SignOut函数如下所示:
IAuthenticationManager authenticationManager = HttpContext.Current.GetOwinContext().Authentication;
authenticationManager.SignOut(StringConstants.ApplicationCookie);
Run Code Online (Sandbox Code Playgroud)
登录是通过jQuery.ajax请求执行的.成功后,Window.location会更新到站点的主页面.
使用Forms和IntegratedWindowsAuthentication(IWA)登录都可以,但是在使用IWA登录时遇到了问题.这是发生的事情:
User.Identity此时的类型为WindowsIdentity与AuthenticationType设置为Negotiate …我使用Graph API查询我的Azure Active Directory,使用该Microsoft.WindowsAzure.ActiveDirectory.GraphHelper项目作为我的请求的基础.
在特定的用例中,我有一个包含数百个用户的组,以及一些组.我希望加载此父组的组成员.我试图请求加载该members属性:
DirectoryService.LoadProperty(school, "members");
Run Code Online (Sandbox Code Playgroud)
我只得到100个结果,所有这些都是用户(同样,该组中有超过100个用户).
我尝试执行a DataServiceQuery但它不支持这样的操作:
var groups = DirectoryService.groups;
Group parentGroup = DirectoryService.groups.Where(it => (it.objectId == parentGroupId)).SingleOrDefault();
groups = (DataServiceQuery<Group>)groups.Where(group => group.memberOf.Contains(parentGroup));
Run Code Online (Sandbox Code Playgroud)
它在第三行失败,表示不支持该表达式.
目前,我能想到的唯一解决方案是加载所有组,LoadPropert(entity, 'memberOf', null)在每个组上运行,然后检查每个组是否是parentGroup的成员(实际上是几个这样的parentGroup之一). 注意-我把null在continuationToken空间,因为这些群体应该只有一个父组的成员.
这非常低效,但我似乎找不到任何其他方式!
有没有其他方法可以做我想做的事情?
我在Windows 7上运行Lync 2013客户端,连接到Lync 2013 Server.
尝试将参与者添加到Lync对话时,被邀请者将被添加到对话的Participants列表中,但在几秒钟后删除并收到以下消息:
An error occurred.
When contacting your support team, reference error ID 486 (source ID 239).
Troubleshooting information is available online, including best practices for using Lync.
Learn More
Run Code Online (Sandbox Code Playgroud)
我尝试邀请的用户从未接听过电话.
"了解更多"文本是一个链接,发送到:
http://r.office.microsoft.com/r/rlidUCErr10?
clid = 1033&p1 = 0&p2 = 29&p3 = 141&p4 = 141&p5 = 141&p6 = 141此地址依次转发:https:
//support.office.com/en-us/article/Generic-Error-b5517285-d4e0-4a92-a58b-96a066d9f3c9?us = en-US&rs = en-US&us = US
此页面是Lync 2010中 "通用错误"的参考...
我在任何地方都找不到关于此错误的信息......这个错误是什么意思?有办法解决吗?
我希望在我的 asp.net mvc 5 应用程序中具有某种具有自动完成功能的人员选择器功能,以搜索特定 Azure AD 组中的用户。这是一个演示“待办事项应用程序”,允许将待办事项分配给属于组成员的用户。
我直接尝试了 Graph API 和 Azure Graph Client 库,但似乎没有找到实现我想要的方法。图 api 允许获取组的成员,但添加过滤器“startswith”失败,因为在添加过滤器时,api 仅返回不包含例如 DisplayName 属性的目录对象......客户端库也没有太大帮助除了批处理功能提供了一种方法但有很多开销......然后我必须获得用户的过滤结果集,而不管组成员身份(使用 api 中的用户列表内容),组的所有成员,然后使用 Linq 找出正确的结果集......对于开发/测试来说可以正常工作,但在有几百个用户的生产中这将是疯狂的......
任何想法或建议将不胜感激。谢谢!
编辑
在我从客户端 Javascript 调用以搜索用户的代码下方;
代码工作正常,如下所示,只是没有应用过滤,这是输入参数 pre(来自 ui 中的文本框)的意图。我得到了访问组的所有成员。
public async Task<JsonResult> FindUser(string pre)
{
string AccessGroupId = ConfigurationManager.AppSettings["AccessGroupId"];
AuthenticationContext authCtx = new AuthenticationContext(String.Format(CultureInfo.InvariantCulture, "{0}/{1}", SecurityConfiguration.LoginUrl, SecurityConfiguration.Tenant));
ClientCredential credential = new ClientCredential(SecurityConfiguration.ClientId, SecurityConfiguration.AppKey);
AuthenticationResult assertionCredential = await authCtx.AcquireTokenAsync(SecurityConfiguration.GraphUrl, credential);
var accessToken = assertionCredential.AccessToken;
var graphUrl …Run Code Online (Sandbox Code Playgroud) 我试图在Windows服务中托管WCF net.pipe服务.我在Windows服务的OnStart()函数中用代码定义服务.我也以类似的方式创建客户端 - 代码.
我已经看到了这个问题,但它似乎总是专门用于在app/web.config文件中定义NetNamedPipe的情况.
尝试调用该服务时,我收到错误:
System.ServiceModel.ProtocolException: The requested upgrade is not supported by 'net.pipe://localhost/manager'. This could be due to mismatched bindings (for example security enabled on the client and not on the server).
Server stack trace:
at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, …Run Code Online (Sandbox Code Playgroud)