ADFS 2.0自定义登录页面实现 - “请求范围无效或不受支持”

时间:2013-09-30 10:24:48

标签: sharepoint authentication active-directory adfs2.0 adfs

我正在尝试设计如何设置我的SharePoint 2013以使用自定义登录页面来登录ADFS 2.0而不是标准登录页面。 我正在学习本教程:http://blog.helloitsliam.com/Lists/Posts/Post.aspx?ID=76

对web.config进行更改后,我将以下代码写入我的页面:

using (var wsFactory = new WSTrustChannelFactory(new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential), new EndpointAddress(endpoint)))
{
    wsFactory.Credentials.UserName.UserName = signInControl.UserName;
    wsFactory.Credentials.UserName.Password = signInControl.Password;

    wsFactory.TrustVersion = TrustVersion.WSTrust13;

    var wsChannel = wsFactory.CreateChannel();

    var requestSecurityToken = new RequestSecurityToken { RequestType = RequestTypes.Issue, AppliesTo = new EndpointReference(AppliesToEndpointUrl), KeyType = KeyTypes.Symmetric };

    try
    {
        var genericSecurityToken = wsChannel.Issue(requestSecurityToken) as GenericXmlSecurityToken;

        var securityTokenHandlers = FederatedAuthentication.ServiceConfiguration.SecurityTokenHandlers;

        var securityToken = securityTokenHandlers.ReadToken(new XmlTextReader(new StringReader(genericSecurityToken.TokenXml.OuterXml)));

        SPSecurity.RunWithElevatedPrivileges(() =>
            Microsoft.SharePoint.IdentityModel.SPFederationAuthenticationModule.Current.SetPrincipalAndWriteSessionToken(securityToken));

        var rUrl = Request.QueryString.Get("Source");

        Response.Redirect(String.IsNullOrEmpty(rUrl) ? "~/Pages/Default.aspx" : rUrl);

    }
    catch (Exception ex)
    {
        Response.Write(ex.StackTrace);
    }

调试器在wsChannel.Issue方法调用上抛出以下错误:

  

ID3082:请求范围无效或不受支持。

现在,我该如何调查此类错误的原因?

0 个答案:

没有答案