SlideShare a Scribd company logo
DEVintersection
Session AS17

End-to-End Security for Your
Web API and MVC Applications
Michele Leroux Bustamante
michelebusta@solliance.net
Michele Leroux Bustamante
Managing Partner
Solliance (solliance.net)
CEO and Cofounder
Snapboard (snapboard.com)
Microsoft Regional Director
Microsoft MVP
Author, Speaker
Pluralsight courses on the way!
Blog: michelebusta.com
michelebusta@solliance.net
@michelebusta

2

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
Hello World!
1992
Hello
World!
Hello World!
2013
WPF
Client

Windows
Phone 8
Windows
Phone 7

iPhone

Windows
8/Surface

Android

Mobile
Browsers

iPad

Web
API

Web API
(mobile)

(ajax)

Web API
(business)

MVC Web
Things are complicated…
So we seek simplicity
where we can
WS-Federation
WS-ReliableMessaging

WS-PolicyAttachment
OASIS Web Services Security

WS*
HELL

WSDL

WS-Coordination

WS-CAF

MTOM

WS-Transfer

WS-Eventing

WS-BusinessActivity

WS-ResourceTransfer

WSRF

DIME

WS-Addressing
SOAP
WS-Federation
WS-ReliableMessaging

WS-PolicyAttachment
OASIS Web Services Security

WS*
HELL

WSDL

WS-Coordination

WS-CAF

MTOM

WS-Transfer

WS-Eventing

WS-BusinessActivity

WS-ResourceTransfer

WSRF

DIME

WS-Addressing
SOAP
Authentication / Authorization Considerations
 Authentication




Windows, username/password, cert
WS-Federation, SAML 2.0, OAuth2 w/ OpenID
Connect

 Token Formats



Windows, Basic
SAML 1.1, SAML 2.0, JSON Web Token (JWT), SWT
(legacy)

 Authorization


Roles, Claims, social scenarios and architecture

 Message Protection (TLS / SSL / WS*)
10

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
Browsers
HTML
View

JS

OK

ajax

View
Controller

Web API
Controller

MVC
Web API
Controller

Web API
Mobile

Browsers

Devices

HTML
View

JS

OK

ajax

View
Controller

View/API
Controller

View
View
Views

MVC
WPF

Client
OK

API
Controller

Web API
Windows
Clients
OK

Windows Mobile

Devices
OK

Other
Clients
OK

iOS Mobile

Android Mobile

Devices

Devices

OK

OK

API
Controller

Web API
Wherever possible
choose the lowest
common denominator
Demo

WebSecurity and Claims
POINTS: WebSecurity and Claims
 Initialize WebSecurity early
 Use ClaimsPrincipal to get all claims (Roles)
 Install AuthorizationAttribute as a filter, use
AllowAnonymousAttribute
 Use AuthorizationAttribute to prevent access by
roles
 Create utilities to streamline use of claims

17

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
Demo

Enabling WIF Sessions
POINTS: WIF Sessions
 Create a custom SessionAuthenticationModule


Encapsulate cookie write/delete, ClaimsPrincipal
create

 For Forms redirect, need WebSecurity enabled


Must delete forms cookie + session cookie

 Other WIF best practices





Use SSL
Server side session cookies (space, load
balancing)
Shared token cache (replay detection, load
balancing)
19

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
POINTS: Additional WIF Techniques
 ClaimsAuthenticationManager


Transform claims from user authentication into
application claims (assumes stored by app)

 ClaimsAuthorizationManager



Use with custom AuthorizationAttribute
See Thinktecture library

 ClaimsPrincipalPermission


DO NOT USE

20

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
Demo

Calling Web API
POINTS: Web API Calls
 Must authenticate calls to Web API
 Trusted Subsystem



No need to authenticate the user again
Provide a key (Windows, Certificate, signed token)

 JWT




New preferred way to send lightweight token
Pass user claims relevant to downstream services

22

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
Social Login and User Consent
 OAuth 2.0



Supports variations of passive and active federation
Popular for used for user consent flows where an applications wants
access to user information from another applications






Sharing flickr photos
Sharing tweets
Facebook integration

NOT for authentication

 Authentication




Twitter
Facebook Connect
OpenID Connect

23

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
User Consent

Browser

3

Login
Page

11
Requested
Information

1

5

4
Authorization
Code

6
Client
Application

8

Store
Tokens

2
Get access token

7

Access + refresh token

9

Authorization
Server

Request information

10

Requested Information

Resource
Server
Social Login / Delegated Authorization
 Typical choices for B-to-B




Username/password
Twitter
Linked In

 Typical choices for B-to-C





Username/password
Twitter
Facebook
(maybe) Google+

 Corporate environments




Windows
Username/password
Live ID

25

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
Registration Options
Create Account
Facebook Registration
Facebook Registration (2)
Twitter Registration
Social Login
Demo

Social Login
Login or Register?
 Make both available
 Make it obvious
 Navigation bar is one option

33

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
Access Control &
Twitter
Browser
3
Google
1

6

2

FaceBook

Yahoo!

Windows
Live

5

Access
Control

Your App

Twitter

4

Your STS
Your App &
Facebook / Twitter
Browser

FaceBook

Twitter

Your App

OAuthWebSecurity
Access Control, Social
& Azure AD (vision)
Browser

Google
Yahoo!

Access
Control

Your App

User
Profile

Azure
AD

FaceBook

Windows
Live
Twitter
Identity and Access Management Tools
 Windows Azure Active Directory




Sync directories with domain
Spin up new directories
Connect with other IdP

 Thinktecture




Code base for IdP and Authorization Server
Fully functional, you own it, you can edit it
WS-Fed and OAuth2, SAML2 coming

 Auth0



Hosted model, affordable, from small bus to enterprise
When you don’t want to own the code, need IdP, Authorization
Server/OpenID Connect support

37

© DEVintersection. All rights reserved.
http://www.DEVintersection.com
References
 Conference resources:


http://michelebusta.com

 See my snapboards:




Currently at the alpha site:
http://snapboardalpha.cloudapp.net/michelebusta
Will move these to snapboard.com/michelebusta when we go live on the
main site (SOON watch my blog for announcement)

 Contact me:



michelebusta@solliance.net
@michelebusta

38

© DEVintersection. All rights reserved.
http://www.DEVintersection.com

More Related Content

PPTX
PDF
SharePointFest 2013 Washington DC - SPT 103 - SharePoint 2013 Extranets: How ...
PPTX
Mobile devices and SharePoint
PDF
SharePoint Saturday The Conference DC - How the bcs saved my marriage
PDF
2014-04-05 - SPSPhilly - Authentication and Authorization
PDF
Membership Plugins in WordPress
PDF
2014-04-05 - SPSPhilly - Getting Started with Office 365
PPT
Rp Live@Edu Sso
SharePointFest 2013 Washington DC - SPT 103 - SharePoint 2013 Extranets: How ...
Mobile devices and SharePoint
SharePoint Saturday The Conference DC - How the bcs saved my marriage
2014-04-05 - SPSPhilly - Authentication and Authorization
Membership Plugins in WordPress
2014-04-05 - SPSPhilly - Getting Started with Office 365
Rp Live@Edu Sso

What's hot (20)

PPTX
Umbraco in 10 minutes
PPT
Kentico CMS Overview
PPTX
SharePoint Authentication And Authorization SPTechCon San Francisco
PDF
SharePoint Saturday The Conference DC - How the client object model saved the...
PPTX
WordCamp GR 2012 Web Apps for the Masses
PPTX
30 on Thursday - Your Digitial Workplace: Store, Share & Sync with Microsoft ...
PDF
Share followsync
PPTX
Joomunited social backlinks
PPT
Architecture of RIA from JAOO
PDF
OAuth 1.0
PPTX
Google Apps Product Slides 3 29 10
PPTX
Everything you need to know about sharing files in SharePoint & OneDrive - SP...
PPTX
Building solutions with SPFx that work across SharePoint and Teams
PDF
Migration from File servers to M365 Business
PPTX
Governance is Not An Option
PPTX
Bulding anextraneto365
PPTX
SharePoint as a Web CMS
PPTX
Share, Follow, and Sync: How SharePoint 2013 uses Personal MySites for Social...
PPTX
XCC Personalization
PPTX
6 types of web application development
Umbraco in 10 minutes
Kentico CMS Overview
SharePoint Authentication And Authorization SPTechCon San Francisco
SharePoint Saturday The Conference DC - How the client object model saved the...
WordCamp GR 2012 Web Apps for the Masses
30 on Thursday - Your Digitial Workplace: Store, Share & Sync with Microsoft ...
Share followsync
Joomunited social backlinks
Architecture of RIA from JAOO
OAuth 1.0
Google Apps Product Slides 3 29 10
Everything you need to know about sharing files in SharePoint & OneDrive - SP...
Building solutions with SPFx that work across SharePoint and Teams
Migration from File servers to M365 Business
Governance is Not An Option
Bulding anextraneto365
SharePoint as a Web CMS
Share, Follow, and Sync: How SharePoint 2013 uses Personal MySites for Social...
XCC Personalization
6 types of web application development
Ad

Viewers also liked (20)

PDF
201401217 potatotips no12-for_slideshare_english
PDF
Mobile Inception - Web API Security
PPTX
Web API Security
PPTX
Web Api services using IBM Datapower
PPTX
Owin and-katana-overview
PPTX
Owin e katana
PDF
ASP.NET MVC Web API -twMVC#8
PPTX
ASP.NET Web API O to 100
PPTX
Moving forward with ASP.NET Core
PPTX
CA API Gateway: Web API and Application Security
PPTX
Design Practices for a Secure Azure Solution
PDF
Tips and Tricks For Faster Asp.NET and MVC Applications
PPTX
Web api crud operations
PPTX
Creating scalable message driven solutions akkadotnet
PPTX
Compatibility testing
PPTX
Middlewares ASP.NET
PPTX
ASP.NET Mvc 4 web api
PPTX
Compatibility testing
PPT
Introduction to Secure Sockets Layer
201401217 potatotips no12-for_slideshare_english
Mobile Inception - Web API Security
Web API Security
Web Api services using IBM Datapower
Owin and-katana-overview
Owin e katana
ASP.NET MVC Web API -twMVC#8
ASP.NET Web API O to 100
Moving forward with ASP.NET Core
CA API Gateway: Web API and Application Security
Design Practices for a Secure Azure Solution
Tips and Tricks For Faster Asp.NET and MVC Applications
Web api crud operations
Creating scalable message driven solutions akkadotnet
Compatibility testing
Middlewares ASP.NET
ASP.NET Mvc 4 web api
Compatibility testing
Introduction to Secure Sockets Layer
Ad

Similar to End to End Security with MVC and Web API (20)

PPT
Introduction to the Windows Live Platform
PPT
CoNGNes 2009 - Microsoft BPOS - 22-01-2009 - Final - PPT2K3
PDF
OAuth in the Real World featuring Webshell
PPTX
Web Contact System Overview - Cisco Integration
PPTX
ad.ppt
PPTX
Ad.Ppt
PPTX
Managing enterprise applications, permissions, and consent in Azure Active Di...
PDF
Managing enterprise applications, permissions, and consent in Azure Active Di...
PPT
Web 2.0 Tech Talk
PDF
Authentication with OAuth and Connected Apps
PPT
SD Forum Java SIG - Service Oriented UI Architecture
PPT
Service Oriented UI Architecture in the world of web, desktop, & mobile appli...
PPTX
Lixsql port enterprise integration
PPTX
SharePoint 2013 App Provisioning Models
PPT
SharePoint in the Extranet Joel Oleson
PPTX
Ws08 R2 Itpro Session 2 Technical Overview Part2
PPTX
Magento Imgine eCommerce Conference February 2011: Mashup of Magento and Sale...
PPT
Cloud 12 08 V2
PDF
API, Integration, and SOA Convergence
PDF
Exchange Server 2013 and SharePoint Server 2013 Integration
Introduction to the Windows Live Platform
CoNGNes 2009 - Microsoft BPOS - 22-01-2009 - Final - PPT2K3
OAuth in the Real World featuring Webshell
Web Contact System Overview - Cisco Integration
ad.ppt
Ad.Ppt
Managing enterprise applications, permissions, and consent in Azure Active Di...
Managing enterprise applications, permissions, and consent in Azure Active Di...
Web 2.0 Tech Talk
Authentication with OAuth and Connected Apps
SD Forum Java SIG - Service Oriented UI Architecture
Service Oriented UI Architecture in the world of web, desktop, & mobile appli...
Lixsql port enterprise integration
SharePoint 2013 App Provisioning Models
SharePoint in the Extranet Joel Oleson
Ws08 R2 Itpro Session 2 Technical Overview Part2
Magento Imgine eCommerce Conference February 2011: Mashup of Magento and Sale...
Cloud 12 08 V2
API, Integration, and SOA Convergence
Exchange Server 2013 and SharePoint Server 2013 Integration

More from Michele Leroux Bustamante (18)

PPTX
You are not excused! How to avoid security blind spots on the way to production
PPTX
Security Tips for Enterprise Azure Solutions
PPTX
So Many Docker Platforms...so little time
PPTX
Surviving Microservices - v2
PPTX
.NET Developer Days - Launching Patterns for Containers
PPTX
.NET Developer Days - So many Docker platforms, so little time...
PPTX
The Ultimate Logging Architecture - You KNOW you want it!
PPTX
The Power of Social Login
PPTX
Unleash Your Inner Startup (Sweden, Dev Sum)
PPTX
Deep thoughts from the real world of azure
PPTX
Security Avalanche
PPTX
Surviving the Azure Avalanche
PPTX
DevOps for Azure
PPT
Windows Azure Essentials V3
PPTX
Channel Your Inner Startup and Go For It!
PPTX
Global Windows Azure Bootcamp - San Diego
PPTX
Windows Azure Essentials
PPTX
Pricing and Revenue Projection in a Cloud-Centric World
You are not excused! How to avoid security blind spots on the way to production
Security Tips for Enterprise Azure Solutions
So Many Docker Platforms...so little time
Surviving Microservices - v2
.NET Developer Days - Launching Patterns for Containers
.NET Developer Days - So many Docker platforms, so little time...
The Ultimate Logging Architecture - You KNOW you want it!
The Power of Social Login
Unleash Your Inner Startup (Sweden, Dev Sum)
Deep thoughts from the real world of azure
Security Avalanche
Surviving the Azure Avalanche
DevOps for Azure
Windows Azure Essentials V3
Channel Your Inner Startup and Go For It!
Global Windows Azure Bootcamp - San Diego
Windows Azure Essentials
Pricing and Revenue Projection in a Cloud-Centric World

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
cuic standard and advanced reporting.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Encapsulation theory and applications.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
A Presentation on Artificial Intelligence
PPTX
MYSQL Presentation for SQL database connectivity
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Modernizing your data center with Dell and AMD
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Electronic commerce courselecture one. Pdf
cuic standard and advanced reporting.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation_ Review paper, used for researhc scholars
Understanding_Digital_Forensics_Presentation.pptx
Network Security Unit 5.pdf for BCA BBA.
Unlocking AI with Model Context Protocol (MCP)
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Encapsulation theory and applications.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
A Presentation on Artificial Intelligence
MYSQL Presentation for SQL database connectivity
The AUB Centre for AI in Media Proposal.docx
Cloud computing and distributed systems.

End to End Security with MVC and Web API