DevForce Silverlight 응용 프로그램에서 Windows 인증을 제대로 작동 시키려면 여러 가지 요소가 필요합니다.SL 응용 프로그램에서 Windows 인증을 사용하도록 DevForce를 구성하는 방법
정확히 무엇입니까? (. 지금 나는 그것이 작동 가지고, 여기에 내 자신의 질문에 대답하기 위하여려고하고있다)의 web.config에서
DevForce Silverlight 응용 프로그램에서 Windows 인증을 제대로 작동 시키려면 여러 가지 요소가 필요합니다.SL 응용 프로그램에서 Windows 인증을 사용하도록 DevForce를 구성하는 방법
정확히 무엇입니까? (. 지금 나는 그것이 작동 가지고, 여기에 내 자신의 질문에 대답하기 위하여려고하고있다)의 web.config에서
, 다음의 모든 필요 :
<system.web>
<authentication mode="Windows" />
<httpRuntime targetFramework="4.5" />
<authorization>
<deny users="?"/>
</authorization>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
다음,이 클래스가 필요합니다
서버 :public class ServiceEvents : IdeaBlade.EntityModel.Server.ServiceHostEvents
{
public override void OnEndpointCreated(System.ServiceModel.Description.ServiceEndpoint endpoint)
{
base.OnEndpointCreated(endpoint);
if (endpoint.Binding is CustomBinding)
{
var binding = endpoint.Binding as CustomBinding;
var elements = binding.CreateBindingElements();
var tbe = elements.Find<TransportBindingElement>();
var httpbe = tbe as HttpTransportBindingElement;
httpbe.AuthenticationScheme = System.Net.AuthenticationSchemes.Negotiate;
endpoint.Binding = new CustomBinding(elements);
}
}
}
그리고 마지막으로, Visual Studio에서 :
var userName = HttpContext.Current.User.Identity.Name;
:
지금 사용자 정의 IEntityLoginManager에, 당신은 도메인 사용자 이름을 사용하려면 다음 사용할 수있는 '사용'하는 그런 다음 userName을 사용하여 사용자의 역할/권한을 조회 할 수 있습니다.
그리고 마지막으로 IIS에서 Windows 인증 기능을 사용하도록 설정해야합니다. 제어판/프로그램 및 기능/Windows 기능 켜기/끄기/World Wide Web 서비스/보안/Windows 인증에서 켜거나 끕니다.
위 단계 중 하나라도 누락되면 userName은 null이됩니다.