Upload
comunidade-netponto
View
899
Download
0
Embed Size (px)
DESCRIPTION
Nesta apresentação, o Henrry aborda diversos tópicos relacionados com a criação e utilização de serviços em WCF no dia-a-dia, entre eles destacam-se técnicas para tratamento de erros de forma mais elegante, validação de user e password ao receber chamadas em um serviço e outras formas de autenticação, tracing, e outros temas, com muitas demonstrações práticas.
Citation preview
Desenvolvimento com Windows Communication Foundation (WCF)
Henrry Pires
http://netponto.org21ª Reunião Lisboa – 18/06/2011
Patrocinadores desta reunião
Henrry Pires
11 anos de experiência profissional em TI
Há 9 anos a programar na plataforma .NET
Agenda
• Tracing
• Segurança
• Tratamento de Erros
Também disponível em vídeo...
Assista!http://vimeo.com/25902708
Tracing
TracingBasicamente queremos fazer tracing serve-nos para obter informações do estado daaplicação. Quando a app arranca, quandodeterminados processos são executados,erros entre outros. Seja qual for a informaçãodisponibilizada, o interesse é sempre omesmo: a app tem informação importantepara disponibilizar
Tracing
Tracing LevelsTrace level Description
Off Does not allow any events through.
Critical Allows only Critical events through.
Error Allows Critical and Error events through.
Warning Allows Critical, Error, and Warning events through.
Information Allows Critical, Error, Warning, and Information events through.
Verbose Allows Critical, Error, Warning, Information, and Verbose events through.
ActivityTracing Allows the Stop, Start, Suspend, Transfer, and Resume events through.
All Allows all events through.
Tracing
Tracing Assembly Assembly Name Description
System.ServiceModel
The most active (from a tracing perspective) of the assemblies. All the stages in the WCF message process are logged, including reading configuration information, performing transport-level actions, and processing
security requests.
System.ServiceModel .MessageLogging
Generates tracing information for all the messages that flow through the system.
System.ServiceModel .IdentityModel
Generates trace data related to the authentication and authorization mechanism used within WCF.
System.Runtime
.Serialization
Provides tracing information when objects are serialized or deserialized. Because this activity occurs quite often in WCF, this set of tracing
information is useful for seeing some of the raw content associated with
messages.
System.IO.Log Generates trace messages associated with accessing the interface to the Common Log File System (CLFS).
CardSpace Generates trace messages related to any CardSpace identity processing
that occurs within the context of a WCF application. System.ServiceModel
.Activation Creates traces related to the activation of the service portion of a WCF
communication channel.
Tracing
Segurança
Segurança
• Infra-estrutura
• A nível de utilizador
Segurança
• Infra-estrutura
– Transporte
– Mensagem
– Transporte com Credencias de Mensagem
Segurança
• A nível de utilizador–Windows Authentication
–Utilizador e password
–Certificados digitais
Segurança
• Transporte
– HTTPS
– TCP/IP
– MSMQ
Segurança
• Mensagem
– Certificados
– IssuedToken
– Utilizador
– Windows
Segurança
• DiferençasMensaguem Transporte
Leva consigo as credenciais Usa o sistema handshaking ou recursos externos para validar a Mensagem
A Mensagem está sempre encriptada Só está encriptada entre os end points
Encriptação parcial, total ou mesmo vários tipos de encriptação dentro da mesmaMensagem
A Mensagem é encriptada na sua totalidade com um único sistema
Segurança
A nível de utilizador
Nem todos os tipos de autenticação sãoválidos para todos os Bindings, exemplodisso é o basicHTTPBinding que só suportacertificados e Utilizador e Password
Segurança
• Certificado
Este método permite através de umcertificado digital autenticar tanto ocliente como o servidor. Todos osoutros métodos usam certificadospara fazer a comunicação
Segurança
Passos necessários para usar o certificado
Segurança
1. Identificar a store (storeName)AddressBook AuthRoot CertificateAuthority Disallowed
My Root TrustedPeople TrustedPublisher
Segurança
2. Localização da store (storeLocation)
CurrentUser
LocalMachine
Segurança
3. Tipo de pesquisa (x509FindType)
FindByThumbprint FindBySubjectName FindBySubjectDistinguishedName
FindByIssuerName
FindBySerialNumber FindByTimeNotYetValid FindByIssuerDistinguishedName
FindByTimeValid
FindByTemplateName FindByCertificatePolicy FindByApplicationPolicy FindByTimeExpired
FindByExtension FindByKeyUsage FindBySubjectKeyIdentifier
Segurança
3. Valor a pesquisar (findValue)
<certificateReferencefindValue="545c9b8e97d91fc75c74eb52c6908320088b4f39"x509FindType="FindByThumbprint"storeLocation="LocalMachine"storeName="My" />
Segurança
Questões?
Patrocinadores desta reunião
Próximas reuniões presenciais
• 18/06/2011 – Junho
• 09/07/2011 – Julho (Coimbra)
• 23/07/2011 – Julho
• 27/08/2011 – Agosto
Reserva estes dias na agenda! :)