1

我正在尝试研究如何设置我的 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:请求范围无效或不受支持。

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

4

0 回答 0