Cannot understand MVC5 + WebApi2 Authorization

Viewed 231

I know what is the concept of OAuth: User sends request to the server with grant type, username and password, after some checks on server, the user receives an access token. What I cannot understand is why I should do this:

        ClaimsIdentity oAuthIdentity = await _userManager.CreateIdentityAsync(user,
            context.Options.AuthenticationType);
        var ticket = new AuthenticationTicket(oAuthIdentity, GenerareProperties(user));
        context.Validated(ticket);

What is CreateIdentityAsync returning? What is an AuthenticationTicket? What does context.Validated do? Also, If I have oAuthIdentity why should I also use cookiesIdentity? And finally, where is the access token being generated?

I searched but cannot find a website that explains this.

1 Answers
Related