novidades de segurança em aspnet core
TRANSCRIPT
Novidades de segurança em ASP.NET Core 1.0
Sérgio Oliveira@sfsoliveira
36 000 000 Contas expostas9 000 000 Transações de Cartão de Credito
5 000 000 Contas de pais 200 000 Dados de crianças
Path to Identity
ASP.NET 1.0
Nepia
ASP.NET 2.0
MembershipProvider
ASP.NET 4.0
SimpleMembership
Provider
ASP.NET 4.5
ASP.NETIdentity 1
ASP.NET 4.5
ASP.NETIdentity 2
ASP.NET Core 1
ASP.NETIdentity 3
OWIN (Open Web Interface for .NET)
UserAgent
Host
Owin Server
ApplicationMNM2M1
(...)
(...)
ASP.NET Core 1.0
UserAgent
Host
DNX
Server
MVCMNM2M1
(...)
(...)
DI
Stack de Segurança em ASP.NET Core 1.0
• ClaimsPrincipal
• Autenticação baseada em Middleware• Cookies• Facebook• Microsoft• ...
• Outros serviços relacionados com segurança• CORS• Logging• Encoding• Anti-forgery Token
• Nova API de Autenticação
• Nova API de proteção de dados
Cookie Authentication Middleware
• Múltiplos esquemas de Autenticação
• Automatic Authenticate
• Automatic Challenge
• Access Denied Path
Autenticação externa
app.UseCookieAuthentication(config =>
{config.AuthenticationScheme = “bolachinhas";config.AutomaticChallenge = false;config.AutomaticAuthenticate = true;
});
app.UseFacebookAuthentication(new FacebookOptions{
AuthenticationScheme = "Facebook",AppId = "203972043795013",AppSecret = "2d2f3db1a84c25cde4922001bb1279c9",SignInScheme = “bolachinhas",AutomaticChallenge = true
});
Autorização
• Já é possível distinguir Unauthorized vs Forbidden
• Separação de regras de negócio e logica de autorização
• Políticas reutilizáveis
• Resource base authorization
Authorize Attribute
[Authorize(Users = "admin")]
[Authorize(Roles = "editor")]
NO MORE
Ainda é Suportado
Resource Based Authentication
• [Utilizador] pede permissão para [ação] sobre [recurso]• Bob pede permissão para editar o post1
Obrigado