English 中文(简体)
WCF 扩展认证
原标题:WCF extend authentication

我需要扩大全球合作框架的认证,因此,我的新候选人应当与内在的认证同时工作。

例如,我希望允许注册的IP(cus)或用户名+密码(ui)。

I ve 成功实施了serviceAuthenticationManager.serviceAuthorizationManager

serviceAuthenticationManager.Authenticate 简单地将<条码> 主要落实到电文性质上,<条码>. 服务AuthorizationManager.CheckAccessCore 复制件<条码>,从新电文的特性到<条码>AuthorizationContext。

然而,对于标准机制而言,serviceAuthenticationManager.Authenticate完全破碎,即使我返回authPolicybase.Authenticate打电话。

我是否走错方向? 如何以正确的方式来增加习俗、社会、文化权利委员会的认证,而不是影响现有的认证? 如果习俗失败,如何回落成认证?

最佳回答

正确做法:

1. OnOpeningovere

Authorization.PrincipalPermissionMode = PrincipalPermissionMode.Custom;
Authorization.ExternalAuthorizationPolicies = new ReadOnlyCollection<IAuthorizationPolicy>(new[] { new MyCustomAuthorizationPolicy() });

在评估习惯政策的方法中,将评价环境的三种特性“遗产”分配给实体、“实体”来收集身份和“主要”到 I Principal

evaluationContext.Properties["PrimaryIdentity"] = identity;
evaluationContext.Properties["Identities"] = new List<IIdentity>(new[] { identity });
evaluationContext.Properties["Principal"] = principal;
问题回答

暂无回答




相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签