Title: WCF-?????? ??????? ????????????
1WCF-?????? ??????? ????????????
?? ????? ?????? Internet-?????????? ??????????
?????????? ??? ????????? 4-?? ????? ???????
???????????? ?????????? ??????????? ??????????
????????? ????????????? ????????????????. ?. ?.
???????
2??????????? ???????????? ?WCF
- ??????????? ???????????? ??????? ??????????????
??????? ??????? ?? - ??????????????,
- ??????????? ???????????? ?? ??????? ? ??????????
?????????? ??? ??????? (???????? ???????????
??????), - ???????????? ???????? ?????????,
- ????? ???????????? (????????) ?? ????? ??????? ??
??????? ????? ??????????? ????????, - ?????????????? ???? ???????????? ? ???????????
????? ???????? ???????????? ???????????. - WCF ???????????? ??? ?????????? ??????????????,
???????????? ????????, ??????????? ?
????????????. ?????????? ??????? ??????????
???????? ? ????????? ??. - ?????????? ?????????
3??????????????
- ??????????????? ?????????? ?????????, ???????
????????, ???????? ?? ?????????? ??????? ??????
???, ?? ???? ??? ???? ??????. WCF ????????????
??? ?????????? ?????????????? - ??? ?????????????? ?????? ?? ????????? ?? ????
????????? ??????. ????????? ????????? ???????????
?????? ?????????. - ?????????????? Windows ?????? ???????? ?
??????????????? ??????? (credentials) ? ?????????
?? ?????????? Windows. - ??? ???????????? ? ?????? ?????? ?????????
?????????? ??? ? ?????? ?? ?????????? ?????????,
????????, ?? ??????? ??????? Windows ??? ??
???????????????? ?? . - ?????????? X509 ?????? ?????????????? ???? ???
?????? ???????????. ?????? ?????????? ?? ???????
??? ????????????? ??????????? ???????????, ?
????????????? ? ???????. ?????? ????? ?????
????????????? ???????? ??????? ????????
??????????. - ???????????????? ???????? WCF ?????????
???????? ???????? ?????????????? ????? ??????????
? ????? ?????????????, ????????, ???????????????
???????. - ?????? ???????????? ????? ????????, Windows
CardSpace.
4???????????
- ??????????? ?????????? ????? ???????? ?????????
?????????? ???????, ?????? ????? ????????
?????? ????????? ???????? ???????. ???????????
???????????? ??? ??????????????. ?????? ??????
????? ???? ?????????? ??????? ? ????? ????????? ?
????????? ? ???, ??? ?????????? ???????
??????????? ? ????????????? ????. - WCF, ?????????? ASP.NET, ???????????? ?????????
????? ???????? ??????????????? ?????????????.
???????? ?????????? ??? - ?????? (??????? ??????) Windows,
- ?????????? ASP.NET ??? ???????? ????????????????
??????? ???????. - WCF ????????? ???????????????? ? ?????????
??????????? ?????? ??? ?????? ?? ???????.
????????????? ???????? ????? ?????? (????????
Identity ?????? EndpointAddress) ????????????
WSDL-????? ?????? ? ???????????????? ?? ????
??????-????????. ??? ????? ?? ??????? ??????
?????????? ?? ????????????? ? ?????????
?????????????? ?????????. ???? ????????
?????????, ?????? ?????? ???????? ? ?????????
???????? ?????? ??????. - ltendpoint... ltidentitygt
- ltdns value"localhost" /gt
- lt/identitygt
- ?????? ???????? ????? ?? ???????? ????????
identity.
DNS-??? ????????????? (?????????? X.509 ???
??????? ?????? Windows). ????? ??? ???????????
????????? ? ?????? ?????. WCF ?????????????
????????? ?????????? ???????.
5???????????? ????????
- ????? ??????? ?????? ???????????? ????????
???????? ????? ??????? ???????? ??? ??????
??????. ?????????? ?????????? ???????????
?????????, ??? ?????????????????? ? ????????
?????????????? ??????? ? ???????. ?????????
?????? ????????????? ????? ?????????
(????????????? ????????? ?????????????
??????????? ?????????) ? ????? ?? ????? ?
???????????? (DoS ????????? ????????? ???????
??????? ??? ???????? ??????? ? ??????). - ?????? ???????? ??????
- None ?????? ?? ???????? ????????????? ???????,
????????? ?????????? ??????? - Transport ???????? ?????? ????????? ??? HTTPS,
TCP, IPC, MSMQ. ????? ?????????????? ???????????
? ?????????????????? ??????. ????????
?????????????? ??????????? ???????????
????????????? (Credentials) ??????? ?????? ?
??????????. ??? ????? ??????? ? ????????????????
?????? ???????? ???????????? ??? ???????????
??????? ? ?????? ??? ??????????? - Message ?????????? ?????????, ????????????
??????????????????, ??????????? ? ????????
??????????? ?? ?????? ????????? SOAP (??????
????????????? ??????) ??? ????????????
??????????, ????? ??? HTTP. - TransportWithMessageCredential ?????????? ?
???? ??? ?????????? ??????.
6???? ??????? ?????? ????????
- ??? ????????? ???? ??? ????? ?????? ????????
?????? ??????????? ? ??? ??????? ?????? ????????
clientCredentialType ?, ????????, ??????
proxyCredentialType ??? ??? ?????????????
???????? ?? ?????? ????? HTTP. - ????????? ???????? ????? ??????? ??????
???????? - None ??? ???????? ??????????? ???????. ????????
?? ?????????. - Basic ????????????? ?????? ??????? ????????
??????????? ? IIS. ??? ????????????? ????? ??????
?? ??????? IIS ?????? ???? ????????? ???????
?????? ????????????? Windows ? ???????????????
?????????? ???????? ??????? NTFS. - Windows ???????? ??????????? ??????????
???????? ???????????? Windows ? IIS. ??? ???????
????? ???????? ????? ??????????????, ??? ??????
????????? ? ?????? Windows, ? ??????? ???
?????????????? ? ???????????? ?????? ????????????
???????? Kerberos. - Certificate ? IIS ????????????? ???????,
?????????, ????? ??????? ??????? ? ??????? ?
?????????????? ???????????. - Digest ????????-???????? ??????????? ???????
??????? ????????, ?? ??????? ?????? ?????????? ?
???? ????, ? ?? ????????? ??????. - Ntlm ????????? ??????? ???????????? NTLM ???
???????? ??????????? ? ?????? ???? ?????????
Kerberos.
7??????? ????????? ????????????
????? ???????????? - Transport
ltbindingsgt ltbasicHttpBindinggt ltbinding
name"wcfService" ltsecurity
mode"Transport"gt lttransport clientCredentialTyp
e"Windows" proxyCredentialType"None" /gt
lt/securitygt ... ??? ???????????? ?????
???????????? ??? ???????? basicHttpBinding, ?????
?????? IIS ? ?????? ????????? ? ????? ??????
Windows. ltbindingsgt ltWSHttpBindinggt
ltbinding name"wcfService" ltsecurity
mode"Message"gt ltmessage clientCredentialType"W
indows" /gt lt/securitygt ... ??? ????????????
???????????? ?? ????????? ??? ????????????
??????? ? ???????? wsHttpBinding.
??? ??????? ?????? ??? Transport - Windows
???????? ??????????? ?? ?????? ?? ???????????
????? ???????????? - Message
??? ??????? ?????? ??? Message - Windows
8????????? (behaviors) ????????????
????????? ???????????? ????????? ????????
????????? ???????? ???????, ?????????
???????????, ???????????? ? ????????? ??????.
?????? ????????????????
?????? ???????? ???????????????? ??????? ?????? ?
?????? ????? ???? ?????? proxy.ClientCredent
ials.UserName.UserName "login"
proxy.ClientCredentials.UserName.Password
"PWD" ?????? ?? ???????? ???
ServiceSecurityContext ssc ServiceSecurityContex
t.Current if (!ssc.IsAnonymous
ssc.PrimaryIdentity ! null) string
userNameServiceSecurityContext.Current.PrimaryIde
ntity.Name ??? ?????????? ??????? ?????????
?????????? ???????????? ???????????.
9???????? ? ?????????????? ??????
???????? Windows (WindowsIdentity) ??? ???????
?????? Windows ??? ??????????? ???? ? ???????
???????????? ??????. ??? ???????????? ????????
???????? ???????? ??????? ??????? ? ???
??????????? ?????? ??????????? (???????????) ??
????????? ??????? ??????. ????????, ??? IIS 7
??? Network Service. ?????????????? ?????????
?????? ??????????? ?? ???????? ???????. ????????,
??? ????? ?????????????? ??? ???????????????,
????????????? ??????? ? ???????? ???????,
SQL-??????? ? ?. ?. ?????? ??????????????
???????? Public viod MyMethod()
using(ServiceSecurityContext.Current.WindowsIdenti
ty.Impersonate()) //?????? ?
?????????????? ???????? ??????? ????
??? ?????????????? ??????? ????????????
?????????????? ???????????, ?? ?????? ???????
???????? ??? ????? ?????????. ? ???? ?????,
?????????????? ??????? ???????? ???????? ????? ?
?????, ?????? ?? ?????????????? ????????. ?????
?????????? ???????? ????? ????????? ? ???????????
????????, ??? ?? ?????? ????? ? ????????.
10?????????
- ?????? ????. ???????? ????? Windows Communication
Foundation. ???. ?????, 2008 . 592 ?. ??. - http//msdn.microsoft.com