Chapter 7Membership, Authorization, and Security

—by Jon Galloway

What's In This Chapter?

  • Requiring login with the Authorize Attribute
  • Requiring role membership using the Authorize Attribute
  • Using security vectors in a web application
  • Coding defensively

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

All code for this chapter is provided via NuGet, as described in this book's introduction. NuGet code samples are clearly indicated with notes at the end of each application section. The NuGet packages are also available at http://www.wrox.com/go/proaspnetmvc5 for offline use.

SECURITY: NOT FUN, BUT INCREDIBLY IMPORTANT

Securing your web applications can seem like a chore. It's something you have to do, but not a whole lot of fun. Nobody looks at your application and says, “Wow! Check out how well they secured my personally identifiable information! This programmer rules!” Security is generally something you have to do because you don't want to be caught in an embarrassing security breach.

No, security doesn't sound like a whole lot of fun. Most of the time, when you read a chapter on security it's either underwritten or overbearing. The good news for you is that we, the authors, read these books, too—a lot of them—and we're quite aware that we're lucky to have you as a reader, and we're not about to abuse that trust. In short, we really want this chapter to be informative because security is very important!

Get Professional ASP.NET MVC 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.