K
K
kid-programmer2014-01-24 19:28:32
ASP.NET
kid-programmer, 2014-01-24 19:28:32

ASP MVC 5. Authentication and authorization?

How is your system of authentication and authorization on projects arranged, your own implementation (if a brief example is possible) or a ready-made OWIN, simple membership provider. I can’t understand how to use the finished owin without violating my domain model where there is a user.
where can I get an exhaustive version for beginners on the topic ... with examples owin

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kid-programmer, 2014-01-24
@kid-programmer

I do it myself, a rough example

//Вход
var claims = new List<Claim>();
claims.Add(new Claim(ClaimTypes.Name, "Brock"));
claims.Add(new Claim(ClaimTypes.Email, "[email protected]"));
var id = new ClaimsIdentity(claims,DefaultAuthenticationTypes.ApplicationCookie);
var ctx = Request.GetOwinContext();
var authenticationManager = ctx.Authentication;
authenticationManager.SignIn(id);

//Выход
var ctx = Request.GetOwinContext();
var authenticationManager = ctx.Authentication;
authenticationManager.SignOut();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question