Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
bingbingbingbing
mono
提交
1ee253f4
M
mono
项目概览
bingbingbingbing
/
mono
与 Fork 源项目一致
从无法访问的项目Fork
通知
35
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mono
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1ee253f4
编写于
10月 14, 2010
作者:
A
Atsushi Eno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fill NetTcpBinding security implementation a bit.
上级
2c810c3e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
76 addition
and
22 deletion
+76
-22
mcs/class/System.ServiceModel/System.ServiceModel.Channels/WindowsStreamSecurityBindingElement.cs
...viceModel.Channels/WindowsStreamSecurityBindingElement.cs
+6
-9
mcs/class/System.ServiceModel/System.ServiceModel/NetTcpBinding.cs
.../System.ServiceModel/System.ServiceModel/NetTcpBinding.cs
+26
-2
mcs/class/System.ServiceModel/System.ServiceModel/TcpTransportSecurity.cs
....ServiceModel/System.ServiceModel/TcpTransportSecurity.cs
+4
-11
mcs/class/System.ServiceModel/Test/System.ServiceModel/NetTcpBindingTest.cs
...erviceModel/Test/System.ServiceModel/NetTcpBindingTest.cs
+40
-0
未找到文件。
mcs/class/System.ServiceModel/System.ServiceModel.Channels/WindowsStreamSecurityBindingElement.cs
浏览文件 @
1ee253f4
...
...
@@ -52,37 +52,34 @@ namespace System.ServiceModel.Channels
throw
new
NotImplementedException
();
}
[
MonoTODO
]
public
ProtectionLevel
ProtectionLevel
{
get
;
set
;
}
public
override
IChannelFactory
<
TChannel
>
BuildChannelFactory
<
TChannel
>
(
BindingContext
context
)
{
throw
new
NotImplementedException
();
return
context
.
BuildInnerChannelFactory
<
TChannel
>
();
}
[
MonoTODO
]
public
override
IChannelListener
<
TChannel
>
BuildChannelListener
<
TChannel
>
(
BindingContext
context
)
{
throw
new
NotImplementedException
();
return
context
.
BuildInnerChannelListener
<
TChannel
>
();
}
[
MonoTODO
]
public
override
bool
CanBuildChannelFactory
<
TChannel
>
(
BindingContext
context
)
{
throw
new
NotImplementedException
();
return
context
.
CanBuildInnerChannelFactory
<
TChannel
>
();
}
[
MonoTODO
]
public
override
bool
CanBuildChannelListener
<
TChannel
>
(
BindingContext
context
)
{
throw
new
NotImplementedException
();
return
context
.
CanBuildInnerChannelListener
<
TChannel
>
();
}
[
MonoTODO
]
public
override
BindingElement
Clone
()
{
return
new
WindowsStreamSecurityBindingElement
(
this
);
...
...
mcs/class/System.ServiceModel/System.ServiceModel/NetTcpBinding.cs
浏览文件 @
1ee253f4
...
...
@@ -36,7 +36,6 @@ using System.Xml;
namespace
System.ServiceModel
{
[
MonoTODO
]
public
class
NetTcpBinding
:
Binding
,
IBindingRuntimePreferences
{
int
max_conn
;
...
...
@@ -48,7 +47,7 @@ namespace System.ServiceModel
TcpTransportBindingElement
transport
=
new
TcpTransportBindingElement
();
public
NetTcpBinding
()
:
this
(
SecurityMode
.
Message
)
:
this
(
SecurityMode
.
Transport
)
{
}
...
...
@@ -145,6 +144,7 @@ namespace System.ServiceModel
var
msg
=
new
BinaryMessageEncodingBindingElement
();
if
(
ReaderQuotas
!=
null
)
ReaderQuotas
.
CopyTo
(
msg
.
ReaderQuotas
);
var
trsec
=
CreateTransportSecurity
();
BindingElement
tr
=
GetTransport
();
List
<
BindingElement
>
list
=
new
List
<
BindingElement
>
();
if
(
tx
!=
null
)
...
...
@@ -152,6 +152,8 @@ namespace System.ServiceModel
if
(
sec
!=
null
)
list
.
Add
(
sec
);
list
.
Add
(
msg
);
if
(
trsec
!=
null
)
list
.
Add
(
trsec
);
list
.
Add
(
tr
);
return
new
BindingElementCollection
(
list
.
ToArray
());
}
...
...
@@ -168,6 +170,7 @@ namespace System.ServiceModel
Security
.
Mode
==
SecurityMode
.
None
)
return
null
;
// FIXME: this is wrong. Could be Asymmetric, depends on Security.Message.AlgorithmSuite value.
SymmetricSecurityBindingElement
element
=
new
SymmetricSecurityBindingElement
();
...
...
@@ -208,6 +211,27 @@ namespace System.ServiceModel
return
element
;
}
BindingElement
CreateTransportSecurity
()
{
switch
(
Security
.
Mode
)
{
case
SecurityMode
.
None
:
case
SecurityMode
.
Message
:
return
null
;
}
// FIXME: consider Security.Transport.ExtendedProtectionPolicy.
switch
(
Security
.
Transport
.
ClientCredentialType
)
{
case
TcpClientCredentialType
.
Windows
:
return
new
WindowsStreamSecurityBindingElement
()
{
ProtectionLevel
=
Security
.
Transport
.
ProtectionLevel
};
case
TcpClientCredentialType
.
Certificate
:
// FIXME: set RequireClientCertificate and IdentityVerifier depending on other properties, if applicable.
return
new
SslStreamSecurityBindingElement
();
default
:
// includes None
return
null
;
}
}
bool
IBindingRuntimePreferences
.
ReceiveSynchronously
{
get
{
throw
new
NotImplementedException
();
}
}
...
...
mcs/class/System.ServiceModel/System.ServiceModel/TcpTransportSecurity.cs
浏览文件 @
1ee253f4
...
...
@@ -34,21 +34,14 @@ namespace System.ServiceModel
[
MonoTODO
]
public
sealed
class
TcpTransportSecurity
{
TcpClientCredentialType
client
;
ProtectionLevel
protection_level
;
internal
TcpTransportSecurity
()
{
ClientCredentialType
=
TcpClientCredentialType
.
Windows
;
// huh
ProtectionLevel
=
ProtectionLevel
.
EncryptAndSign
;
}
public
TcpClientCredentialType
ClientCredentialType
{
get
{
return
client
;
}
set
{
client
=
value
;
}
}
public
TcpClientCredentialType
ClientCredentialType
{
get
;
set
;
}
public
ProtectionLevel
ProtectionLevel
{
get
{
return
protection_level
;
}
set
{
protection_level
=
value
;
}
}
public
ProtectionLevel
ProtectionLevel
{
get
;
set
;
}
}
}
mcs/class/System.ServiceModel/Test/System.ServiceModel/NetTcpBindingTest.cs
浏览文件 @
1ee253f4
...
...
@@ -56,6 +56,46 @@ namespace MonoTests.System.ServiceModel
Assert
.
IsFalse
(
n
.
TransactionFlow
,
"#4"
);
var
tx
=
n
.
CreateBindingElements
().
Find
<
TransactionFlowBindingElement
>
();
Assert
.
IsNotNull
(
tx
,
"#tx1"
);
Assert
.
AreEqual
(
SecurityMode
.
Transport
,
n
.
Security
.
Mode
,
"#sec1"
);
Assert
.
AreEqual
(
ProtectionLevel
.
EncryptAndSign
,
n
.
Security
.
Transport
.
ProtectionLevel
,
"#sec2"
);
Assert
.
AreEqual
(
TcpClientCredentialType
.
Windows
/*huh*/
,
n
.
Security
.
Transport
.
ClientCredentialType
,
"#sec3"
);
var
bc
=
n
.
CreateBindingElements
();
Assert
.
AreEqual
(
4
,
bc
.
Count
,
"#bc1"
);
Assert
.
AreEqual
(
typeof
(
TransactionFlowBindingElement
),
bc
[
0
].
GetType
(),
"#bc2"
);
Assert
.
AreEqual
(
typeof
(
BinaryMessageEncodingBindingElement
),
bc
[
1
].
GetType
(),
"#bc3"
);
Assert
.
AreEqual
(
typeof
(
WindowsStreamSecurityBindingElement
),
bc
[
2
].
GetType
(),
"#bc4"
);
Assert
.
AreEqual
(
typeof
(
TcpTransportBindingElement
),
bc
[
3
].
GetType
(),
"#bc5"
);
Assert
.
IsFalse
(
n
.
CanBuildChannelFactory
<
IRequestChannel
>
(),
"#cbf1"
);
Assert
.
IsFalse
(
n
.
CanBuildChannelFactory
<
IOutputChannel
>
(),
"#cbf2"
);
Assert
.
IsFalse
(
n
.
CanBuildChannelFactory
<
IDuplexChannel
>
(),
"#cbf3"
);
Assert
.
IsTrue
(
n
.
CanBuildChannelFactory
<
IDuplexSessionChannel
>
(),
"#cbf4"
);
}
[
Test
]
public
void
MessageSecurityAndBindings
()
{
var
n
=
new
NetTcpBinding
();
n
.
Security
.
Mode
=
SecurityMode
.
Message
;
Assert
.
AreEqual
(
SecurityAlgorithmSuite
.
Default
,
n
.
Security
.
Message
.
AlgorithmSuite
,
"#sec1"
);
Assert
.
AreEqual
(
MessageCredentialType
.
Windows
/*huh*/
,
n
.
Security
.
Message
.
ClientCredentialType
,
"#sec2"
);
Assert
.
AreEqual
(
TransferMode
.
Buffered
,
n
.
TransferMode
,
"#sec3"
);
var
bc
=
n
.
CreateBindingElements
();
Assert
.
AreEqual
(
4
,
bc
.
Count
,
"#bc1"
);
Assert
.
AreEqual
(
typeof
(
TransactionFlowBindingElement
),
bc
[
0
].
GetType
(),
"#bc2"
);
Assert
.
AreEqual
(
typeof
(
SymmetricSecurityBindingElement
),
bc
[
1
].
GetType
(),
"#bc3"
);
Assert
.
AreEqual
(
typeof
(
BinaryMessageEncodingBindingElement
),
bc
[
2
].
GetType
(),
"#bc4"
);
Assert
.
AreEqual
(
typeof
(
TcpTransportBindingElement
),
bc
[
3
].
GetType
(),
"#bc5"
);
Assert
.
IsFalse
(
n
.
CanBuildChannelFactory
<
IRequestChannel
>
(),
"#cbf1"
);
Assert
.
IsFalse
(
n
.
CanBuildChannelFactory
<
IOutputChannel
>
(),
"#cbf2"
);
Assert
.
IsFalse
(
n
.
CanBuildChannelFactory
<
IDuplexChannel
>
(),
"#cbf3"
);
Assert
.
IsTrue
(
n
.
CanBuildChannelFactory
<
IDuplexSessionChannel
>
(),
"#cbf4"
);
}
[
Test
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录