Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 块长度与其补码不匹配_C#_Saml 2.0_Adfs - Fatal编程技术网

C# 块长度与其补码不匹配

C# 块长度与其补码不匹配,c#,saml-2.0,adfs,C#,Saml 2.0,Adfs,我正在尝试处理一个站点的重定向身份验证。我在Server2012 R2上配置了ADFS来处理这个问题。我在我发送请求的域中使用URL建立了依赖方信任。我将端点添加回了它们来自的特定页面 基本上,我把这些东西带到这里: 尝试通过简单的SAML请求令牌发送 public static string SAMLRequest = @"<samlp:AuthnRequest xmlns:samlp=""urn:oasis:names:tc:SAML:2.0:proto

我正在尝试处理一个站点的重定向身份验证。我在Server2012 R2上配置了ADFS来处理这个问题。我在我发送请求的域中使用URL建立了依赖方信任。我将端点添加回了它们来自的特定页面

基本上,我把这些东西带到这里:

尝试通过简单的SAML请求令牌发送

        public static string SAMLRequest = @"<samlp:AuthnRequest
        xmlns:samlp=""urn:oasis:names:tc:SAML:2.0:protocol""
        xmlns:saml=""urn:oasis:names:tc:SAML:2.0:assertion""
        ID=""{0}""
        Version=""2.0""
        AssertionConsumerServiceIndex=""0""
        AttributeConsumingServiceIndex=""0"">
        <saml:Issuer>URN:xx-xx-xx</saml:Issuer>
        <samlp:NameIDPolicy
            AllowCreate = ""true""
            Format=""urn:oasis:names:tc:SAML:2.0:nameid-format:transient"" />
    </samlp:AuthnRequest>";
当所有这些都完成后,页面会将我重定向到适当的端点,标记base64编码正确。嗯,有点恰当

在adfs方面,我在页面上得到一个错误,然后它就停止了身份验证。在AD FS的事件查看器中,我发现了一个神秘的错误:

System.IO.InvalidDataException: Block length does not match with its complement.

我尝试过处理压缩和请求对象本身的一些属性,但都没有用。有人知道我可以试试这个坏小子吗?

假设
DeflaterOutputStream
来自SharpZipLib,
新的DeflaterOutputStream(output)
实际上会给你一个ZLIB输出流,也就是说,不是真正的DEFLATE,来自。不同之处在于ZLIB添加了一个页眉和页脚来进行DEFLATE,您可以使用
newdeflateroutputstream(输出,新的Deflater(级别:Deflater.DEFAULT_压缩,nozlibheaderooter:true))在SharpZipLib中对其进行抑制

手动创建saml 2.0请求有什么原因吗?我没有看到一个库可以让我轻松地为重定向构建saml请求令牌。如果你知道一个好的,我洗耳恭听。重点是,SAML1.1和2.0相比是受支持的。这就是为什么我问你为什么选择2.0。演示如何剥离ZLIB页眉和页脚,以便
DeflateStream
可用于剩余的Deflate数据。@jnm2 omg谢谢。发现剥离头文件和校验和可以使.Net DeflateStream正常工作,我们就不用在假定文件被一个邪恶的开源java压缩库破坏的情况下走上错误的道路了。
System.IO.InvalidDataException: Block length does not match with its complement.