Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Enterprise Application Architecture with .NET Core

You're reading from   Enterprise Application Architecture with .NET Core An architectural journey into the Microsoft .NET open source platform

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781786468888
Length 564 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (4):
Arrow left icon
Ganesan Senthilvel Ganesan Senthilvel
Author Profile Icon Ganesan Senthilvel
Ganesan Senthilvel
Adwait Ullal Adwait Ullal
Author Profile Icon Adwait Ullal
Adwait Ullal
Habib Qureshi Habib Qureshi
Author Profile Icon Habib Qureshi
Habib Qureshi
Ovais Mehboob Ahmed Khan Ovais Mehboob Ahmed Khan
Author Profile Icon Ovais Mehboob Ahmed Khan
Ovais Mehboob Ahmed Khan
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Enterprise Architecture Concepts FREE CHAPTER 2. Principles and Patterns 3. Distributed Computing 4. Software Development Life Cycle 5. Enterprise Practices in Software Development 6. Layered Approach to Solution Architecture 7. SOA Implementation with .NET Core 8. Cloud-Based Architecture and Integration with .NET Core 9. Microservices Architecture 10. Security Practices with .NET Core 11. Modern AI Offerings by Microsoft

Using cookie middleware without ASP.NET Core Identity

If you want to use your own data store and login controls to authenticate a user, Cookie middleware is the best choice. Cookie middleware serializes the user principal into an encrypted cookie and it uses that cookie to validate users on every request. The user principal can be retrieved by calling the HttpContext.User property.

Cookie middleware can be used by adding a NuGet package named Microsoft.AspNetCore.Authentication.Cookies and the following code snippet in the Configure method in the Startup class:

    CookieAuthenticationOptions options = new   
CookieAuthenticationOptions();
options.AuthenticationScheme = "CookiesMiddlewareAuth";
options.LoginPath = "/Account/Login";
options.AccessDeniedPath = "/Account/AccessDenied";
options.AutomaticAuthenticate = true;
options.AutomaticChallenge = true;
...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime