SlideShare a Scribd company logo
Drew DiPalma – Sr. Product Manager, Cloud
Application Security from Day 1
How often do you put the security of your application first?
Traditional Application Structure
Presentation
UI Components
UI Process Components
Business
Business
Workflow
Business
Components
Business
Entities
Application Facade
Data
Data Access
Components
Data Helper
Utilities
Server Agents
Data Sources
Users
External
Systems
Service
Interface
Let’s break down the pieces –
Data
Users Systems
API
Hosting
Data Access
Business Logic / Integrations
What do we trust?
Data
Users Systems
API
Hosting
Data Access
Data
Users Systems
API
Hosting
Data Access
Business Logic / Integrations
Requests from
the browser?
Users? Integrity/Security
Of upstream services
Connection between
the browser and app?
Endpoints between
Services?
Presentation
UI Components
UI Process Components
Business
Business
Workflow
Business
Components
Business
Entities
Application Facade
Data
Data Access
Components
Data Helper
Utilities
Server Agents
Data Sources
Users
External
Systems
Benefits of a platform
Automatic initial
configuration of security
Regular penetration testing
and security audits
Streamlined assessment,
updates, and patches
Strict access and storage
policies
Data
Users Systems
API
Hosting
Data Access
Business Logic / Integrations
QueryAnywhere
Simple, streamlined syntax
for data access, robust
access rules, hosting
included
Build full apps for iOS,
Android, Web, and IoT
Functions
Integrate server-side logic +
microservices + cloud
services
Power apps with Server-side
logic, or enable Data as a
Service with custom APIs.
Triggers
Real-time notifications let your
application functions react in
response to database changes
App responds immediately to
change
Mobile Sync
Automatically synchronizes
data between documents
held locally in MongoDB
Mobile and your backend
database
(Beta)
Stitch provides services to build applications –
• Write generic requests from applications
• Rule-based Access set by Asset/Document
SDKs:
• JavaScript, Android, and iOS SDKs
• Integrated Authentication, Database, and Service
requests
Stitch Rules:
• Fine-grained access rules relating to all aspects of
Stitch
• Access to context from users, request, external
services, functions, etc.
Stitch
(Authentication & Access rules)
Application
(Stitch SDK)
MongoDB
Stitch QueryAnywhere
Stitch Functions
• Stitch is a set of servers that process requests
Requests:
• Single actions for Database or Services
• Or executing a Stitch Function
• Integrated with Stitch’s Rules
Functions:
• Scalable, hosted JavaScript (ES6) Functions
• Integrated with application context
• User, Request, Services, Values, etc.
Stitch Functions
addtoCart calcStats
… sendMail
Application
(Stitch SDK)
MongoDB
Identity & Authenication
Authentication Overview
Stitch provides built-in
Authentication:
§ Anonymous
§ Email/Password
§ API Key
§ Facebook/Google
§ Custom Authentication
Alternatively, use an auth library like
Passport.js, Auth0, or Cognito
§ Authenication links request to identity
§ Users want options for authentication
§ Credential storage introduces risk
§ Auth frameworks provide choice, stability
and scalability
Authentication with Stitch
StitchClientExternal Auth Provider
1 1-2. If using Facebook, Google, or
Custom Auth user completes a
separate auth flow.
3
2
3. Stitch receives the token/
credential and validates it.
4. Stitch returns an access/ refresh
token to the client.
Any Auth triggers associated with the
provider run. On initial log-in a user
may be created.
4
Data Access
Authorization Overview
Stitch provides Rule-based
access for:
§ Read
§ Write
§ Authentication
§ Function/Service calle
Alternatively, use info about the user and
authentication context to assign a role for
server-side access
Alternatives:
§ RBAC – Create roles that users inherit
permissions from
§ ABAC – Center rules around assets within
your application
§ Rules-based – Create a rules that evaluate
It can be easy to start by access choices on a per-call basis, but…
ELB
Stitch Request
Processing
Atlas
Stitch
Metadata
1 Services
The user requests to run a function
and Stitch SDKs check authentication,
refreshing if necessary.
1 Authentication Check
User
Stitch Function Access
ELB
Stitch Request
Processing
Atlas
Stitch
Metadata
2
Services
Stitch requests hit a load balancer
which distributes them across available
capacity within a region.
2 Load Balancer
User
Stitch Function Access
ELB
Stitch Request
Processing
Atlas
Stitch
Metadata
3
Services
Stitch requests are processed by a set
of multi-tenant Go servers. Each
request is run within a goroutine. All
JavaScript is run by Otto.
3 Request Processor
User
Stitch Function Access
ELB
Stitch Request
Processing
Atlas
Stitch
Metadata
4
Services
Stitch coordinates with a metadata
instance used for: application
definition, authentication, end-user
information, and logs. For functions,
Stitch will check if the user has the
permissions to run it.
3 Stitch Metadata
User
Stitch Function Access
ELB
Stitch Core
Request Processing
Atlas
Stitch
Metadata
4
Services
When Stitch works with Atlas it keeps
connections alive and pools whenever
possible. Service interactions are
done over standard HTTPS. All
requests are subject to rules and Atlas
requests have Read, Write, and
Validation rules
4 Service Coordination
User
Stitch Function Access
Data Access in Practice
{
"userid":"101",
"name": "Bernice Herrera",
"employeeId": 53164957,
"zip": 2082,
"position": "IT Manager",
"manager": "Ralph McBride",
"hiringDate": ISODate("2017-05-02"),
"employeeSource": "website ads",
"salary": 205000,
"gender": "female",
"dob": ISODate("1972-10-02"),
"citizenship": "Australia",
"email": "bernice.herrera@example.com",
"empStatus": "active"
}
Sensitive
Information
Rules for Data Access
{
"filters": [{
"name": "ActiveOnly",
"apply_when": {"%%true" : true},
"query": {"empStatus":"active"}
}, … ],
"roles": [{
name: "OwnData"
apply_when: {"userid":"%%user.id"}
"fields": {
"name": {"read": true},
"salary": {"read": true}}
},
"additional fields": {
"read": false,
"write": false
}}, … ],
"schema": {…}
}
Filters
Roles
Rules
Schema
Finding Data
User
db.collection.find()
(plus user info)
db.collection.find({"empStatus": "active"})
[{
userid: "101"
name: …,
salary: …,
empStatus:"active"
},{
userid: "404"
name: …,
salary: …,
empStatus: "terminated",
}]
Results
{
"name": "ActiveOnly",
"apply_when": {"%%true" : true},
"query": {"empStatus":"active"}
}
Filters contain an apply_when and a
Query which is appended to a request
[{
userid: "101"
name: …,
salary: …,
empStatus:"active"
}]
Finding Data
[{ userid: "101"
name: …
salary: …
empStatus: "active"}]
Roles are defined by Match statements,
evaluated per document, and assign a set of
Rules per document
User
{name: "OwnData",
apply_when: {"userid":"%%user.id"},
fields: {…}
}
[{ userid: "101"
name: …
salary: …
empStatus: "active"}]
userid: "101"
Finding Data
User
Each Role has a set of matching Rules that define
read and write access at the field-level
[{ userid: "101"
name: …
salary: …
empStatus: "active"}]
"fields": {
"name" :{ "read": true},
"salary":{"read": true}
},
"additional_fields": {
"read": false,
"write": false
}
userid: "101"
[{ userid: "101"
name: …
salary: …}]
Updating Data
JSON Schema
schema: {
bsonType: "object",
required: ["userid", "email", "name"],
properties: {
userid: {
bsonType: "objectid",
description: "The ID of the Stitch user"
},
email: {
bsonType: "string",
description: "must be a string and is required"
},
name: {
bsonType: "string",
description: "must be a string and is required"
}
}
Schema Validation
schema: {
bsonType: "object",
required: ["userid", "email", "name"],
properties: {
userid: {
bsonType: "objectid",
description: "The ID of the Stitch user"
},
email: {
bsonType: "string",
validate: {"%%true": {
"%function": {
"name": "isValid",
"arguments": ["%%user", "%%this"]}
}},
description: "must be a string and is not required"
},
name: {
bsonType: "bool",
description: "True if the data is a secret"
}
[...]
Streamlining Performance
Performance hinges on assets evaluated in a request.
§ Use Filters to limit the data sent to the server and checked
§ Project out unnecessary fields to skip their evaluation
§ Use Functions run as System to avoid rules when appropriate
Demo
Stitch Roadmap
Rules
• Additional Rules Context
• Function-enhanced Rules
• Caching for Rules evaluation
• Alerts on permissive Rules
Authentication
• UI Elements for Auth
• Function-based Authentication
• Configurable email/password
confirmation flows
• Apple Sign-in support
Development
• Automatic Github Deployment
• Draft deploys for Stitch UI
• Better API Creation Support
• Static Hosting GA
• Additional Watch() support
Stitch has recently announced HIPAA and ISO compliance
What’s Next?
Get started at stitch.mongodb.com
Stitch
§ Tutorial: Modern Web Dev with MongoDB Stitch – 12:45pm Tuesday – Naussau
§ Check out the Stitch POD on Wednesday!
Realm
§ REST-less Mobile Apps – 9:00am Tuesday – Rhinelander South
§ Realm: The Secret Sauce for Better Mobile Apps – 3:00pm Tuesday – Murray Hill
§ Check out the Realm Mobile POD on Wednesday
MongoDB World 2019: Securing Application Data from Day One
Titles on one line looks so much better
First line of copy is not bulleted. Use bold or green font treatment to
place emphasize on content.
§ Bullet one - use Paragraph > Increase List Level to add bullet
§ Bullet two – click Increase List Level again for next level bullet
§ Bullet three – click Increase List Level again for next level bullet

More Related Content

PDF
MongoDB World 2019: Building Flexible and Secure Customer Applications with M...
PDF
MongoDB World 2019: Using the MongoDB Enterprise Kubernetes Operator to Scale...
PDF
MongoDB World 2019: Mastering MongoDB in Kubernetes
PDF
MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...
PDF
MongoDB World 2019: Fast Machine Learning Development with MongoDB
PPTX
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
PDF
Design patterns for microservice architecture
PPTX
"Dynamic configuration in .NET", Serhii Buta
MongoDB World 2019: Building Flexible and Secure Customer Applications with M...
MongoDB World 2019: Using the MongoDB Enterprise Kubernetes Operator to Scale...
MongoDB World 2019: Mastering MongoDB in Kubernetes
MongoDB World 2019: Look, Ma, No Servers! Serverless Application Development ...
MongoDB World 2019: Fast Machine Learning Development with MongoDB
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
Design patterns for microservice architecture
"Dynamic configuration in .NET", Serhii Buta

What's hot (20)

PDF
.NET Fest 2017. Anton Moldovan. How do we cook highload microservices at SBTech?
PPTX
Continuous Integration (& Mr Jenkins)
PPTX
.NET Fest 2017. Андрей Антиликаторов. Проектирование и разработка приложений ...
PPTX
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
PPTX
Building a document e-signing workflow with Azure Durable Functions
PPTX
Azure AD B2C An Introduction - DogFoodCon 2018
PPTX
Code Generation for Azure with .net
PPTX
Microservice.net by sergey seletsky
PPTX
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
PPTX
"Project Tye to Tie .NET Microservices", Oleg Karasik
PDF
Programming with Azure Active Directory
PDF
70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS
PPTX
2 Speed IT powered by Microsoft Azure and Minecraft
PPTX
Azure Functions - Introduction
PPTX
Azure Key Vault - Getting Started
PPTX
The bits and pieces of Azure AD B2C
PDF
Building Scalable Web Applications Using Microservices Architecture and NodeJ...
PPTX
.NET Fest 2017. Денис Резник. Исполнение Запроса в SQL Server. Ожидание - Реа...
ODP
micro services architecture (FrosCon2014)
PPTX
The Rise of Microservices - Containers and Orchestration
.NET Fest 2017. Anton Moldovan. How do we cook highload microservices at SBTech?
Continuous Integration (& Mr Jenkins)
.NET Fest 2017. Андрей Антиликаторов. Проектирование и разработка приложений ...
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Building a document e-signing workflow with Azure Durable Functions
Azure AD B2C An Introduction - DogFoodCon 2018
Code Generation for Azure with .net
Microservice.net by sergey seletsky
Running Regulated Workloads on Azure PaaS services (DogFoodCon 2018)
"Project Tye to Tie .NET Microservices", Oleg Karasik
Programming with Azure Active Directory
70-534: ARCHITECTING MICROSOFT AZURE SOLUTIONS
2 Speed IT powered by Microsoft Azure and Minecraft
Azure Functions - Introduction
Azure Key Vault - Getting Started
The bits and pieces of Azure AD B2C
Building Scalable Web Applications Using Microservices Architecture and NodeJ...
.NET Fest 2017. Денис Резник. Исполнение Запроса в SQL Server. Ожидание - Реа...
micro services architecture (FrosCon2014)
The Rise of Microservices - Containers and Orchestration
Ad

Similar to MongoDB World 2019: Securing Application Data from Day One (20)

PPTX
MongoDB World 2018: Evolving your Data Access with MongoDB Stitch
PPTX
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
PPTX
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
PDF
Evolving your Data Access with MongoDB Stitch
PPTX
MongoDB.local Atlanta: Introduction to Serverless MongoDB
PPTX
Tutorial: Building Your First App with MongoDB Stitch
PPTX
Building Your First App with MongoDB Stitch
PPTX
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
PPTX
MongoDB Stitch Introduction
PDF
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDB
PPTX
Serverless Application Development with MongoDB Stitch
PPTX
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
PPTX
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
PDF
MongoDB.local Berlin: App development in a Serverless World
PPTX
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
PPTX
MongoDB Stich Overview
PPTX
Building Your First App with MongoDB Stitch
PDF
MongoDB Mobile
PPTX
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
PPTX
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
MongoDB World 2018: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch
MongoDB.local Atlanta: Introduction to Serverless MongoDB
Tutorial: Building Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
MongoDB Stitch Introduction
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDB
Serverless Application Development with MongoDB Stitch
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB.local Berlin: App development in a Serverless World
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
MongoDB Stich Overview
Building Your First App with MongoDB Stitch
MongoDB Mobile
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Ad

More from MongoDB (20)

PDF
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
PDF
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
PDF
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
PDF
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
PDF
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
PDF
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
PDF
MongoDB SoCal 2020: MongoDB Atlas Jump Start
PDF
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
PDF
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
PDF
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
PDF
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
PDF
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
PDF
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
PDF
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
PDF
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
PDF
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
PDF
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
PDF
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
PDF
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Cloud computing and distributed systems.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Empathic Computing: Creating Shared Understanding
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Machine learning based COVID-19 study performance prediction
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Spectroscopy.pptx food analysis technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Cloud computing and distributed systems.
NewMind AI Weekly Chronicles - August'25 Week I
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation_ Review paper, used for researhc scholars
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding
Building Integrated photovoltaic BIPV_UPV.pdf
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Machine learning based COVID-19 study performance prediction
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
The AUB Centre for AI in Media Proposal.docx
Spectroscopy.pptx food analysis technology

MongoDB World 2019: Securing Application Data from Day One

  • 1. Drew DiPalma – Sr. Product Manager, Cloud Application Security from Day 1
  • 2. How often do you put the security of your application first?
  • 3. Traditional Application Structure Presentation UI Components UI Process Components Business Business Workflow Business Components Business Entities Application Facade Data Data Access Components Data Helper Utilities Server Agents Data Sources Users External Systems Service Interface
  • 4. Let’s break down the pieces – Data Users Systems API Hosting Data Access Business Logic / Integrations
  • 5. What do we trust? Data Users Systems API Hosting Data Access Data Users Systems API Hosting Data Access Business Logic / Integrations Requests from the browser? Users? Integrity/Security Of upstream services Connection between the browser and app? Endpoints between Services?
  • 6. Presentation UI Components UI Process Components Business Business Workflow Business Components Business Entities Application Facade Data Data Access Components Data Helper Utilities Server Agents Data Sources Users External Systems Benefits of a platform Automatic initial configuration of security Regular penetration testing and security audits Streamlined assessment, updates, and patches Strict access and storage policies Data Users Systems API Hosting Data Access Business Logic / Integrations
  • 7. QueryAnywhere Simple, streamlined syntax for data access, robust access rules, hosting included Build full apps for iOS, Android, Web, and IoT Functions Integrate server-side logic + microservices + cloud services Power apps with Server-side logic, or enable Data as a Service with custom APIs. Triggers Real-time notifications let your application functions react in response to database changes App responds immediately to change Mobile Sync Automatically synchronizes data between documents held locally in MongoDB Mobile and your backend database (Beta) Stitch provides services to build applications –
  • 8. • Write generic requests from applications • Rule-based Access set by Asset/Document SDKs: • JavaScript, Android, and iOS SDKs • Integrated Authentication, Database, and Service requests Stitch Rules: • Fine-grained access rules relating to all aspects of Stitch • Access to context from users, request, external services, functions, etc. Stitch (Authentication & Access rules) Application (Stitch SDK) MongoDB Stitch QueryAnywhere
  • 9. Stitch Functions • Stitch is a set of servers that process requests Requests: • Single actions for Database or Services • Or executing a Stitch Function • Integrated with Stitch’s Rules Functions: • Scalable, hosted JavaScript (ES6) Functions • Integrated with application context • User, Request, Services, Values, etc. Stitch Functions addtoCart calcStats … sendMail Application (Stitch SDK) MongoDB
  • 11. Authentication Overview Stitch provides built-in Authentication: § Anonymous § Email/Password § API Key § Facebook/Google § Custom Authentication Alternatively, use an auth library like Passport.js, Auth0, or Cognito § Authenication links request to identity § Users want options for authentication § Credential storage introduces risk § Auth frameworks provide choice, stability and scalability
  • 12. Authentication with Stitch StitchClientExternal Auth Provider 1 1-2. If using Facebook, Google, or Custom Auth user completes a separate auth flow. 3 2 3. Stitch receives the token/ credential and validates it. 4. Stitch returns an access/ refresh token to the client. Any Auth triggers associated with the provider run. On initial log-in a user may be created. 4
  • 14. Authorization Overview Stitch provides Rule-based access for: § Read § Write § Authentication § Function/Service calle Alternatively, use info about the user and authentication context to assign a role for server-side access Alternatives: § RBAC – Create roles that users inherit permissions from § ABAC – Center rules around assets within your application § Rules-based – Create a rules that evaluate It can be easy to start by access choices on a per-call basis, but…
  • 15. ELB Stitch Request Processing Atlas Stitch Metadata 1 Services The user requests to run a function and Stitch SDKs check authentication, refreshing if necessary. 1 Authentication Check User Stitch Function Access
  • 16. ELB Stitch Request Processing Atlas Stitch Metadata 2 Services Stitch requests hit a load balancer which distributes them across available capacity within a region. 2 Load Balancer User Stitch Function Access
  • 17. ELB Stitch Request Processing Atlas Stitch Metadata 3 Services Stitch requests are processed by a set of multi-tenant Go servers. Each request is run within a goroutine. All JavaScript is run by Otto. 3 Request Processor User Stitch Function Access
  • 18. ELB Stitch Request Processing Atlas Stitch Metadata 4 Services Stitch coordinates with a metadata instance used for: application definition, authentication, end-user information, and logs. For functions, Stitch will check if the user has the permissions to run it. 3 Stitch Metadata User Stitch Function Access
  • 19. ELB Stitch Core Request Processing Atlas Stitch Metadata 4 Services When Stitch works with Atlas it keeps connections alive and pools whenever possible. Service interactions are done over standard HTTPS. All requests are subject to rules and Atlas requests have Read, Write, and Validation rules 4 Service Coordination User Stitch Function Access
  • 20. Data Access in Practice { "userid":"101", "name": "Bernice Herrera", "employeeId": 53164957, "zip": 2082, "position": "IT Manager", "manager": "Ralph McBride", "hiringDate": ISODate("2017-05-02"), "employeeSource": "website ads", "salary": 205000, "gender": "female", "dob": ISODate("1972-10-02"), "citizenship": "Australia", "email": "bernice.herrera@example.com", "empStatus": "active" } Sensitive Information
  • 21. Rules for Data Access { "filters": [{ "name": "ActiveOnly", "apply_when": {"%%true" : true}, "query": {"empStatus":"active"} }, … ], "roles": [{ name: "OwnData" apply_when: {"userid":"%%user.id"} "fields": { "name": {"read": true}, "salary": {"read": true}} }, "additional fields": { "read": false, "write": false }}, … ], "schema": {…} } Filters Roles Rules Schema
  • 22. Finding Data User db.collection.find() (plus user info) db.collection.find({"empStatus": "active"}) [{ userid: "101" name: …, salary: …, empStatus:"active" },{ userid: "404" name: …, salary: …, empStatus: "terminated", }] Results { "name": "ActiveOnly", "apply_when": {"%%true" : true}, "query": {"empStatus":"active"} } Filters contain an apply_when and a Query which is appended to a request [{ userid: "101" name: …, salary: …, empStatus:"active" }]
  • 23. Finding Data [{ userid: "101" name: … salary: … empStatus: "active"}] Roles are defined by Match statements, evaluated per document, and assign a set of Rules per document User {name: "OwnData", apply_when: {"userid":"%%user.id"}, fields: {…} } [{ userid: "101" name: … salary: … empStatus: "active"}] userid: "101"
  • 24. Finding Data User Each Role has a set of matching Rules that define read and write access at the field-level [{ userid: "101" name: … salary: … empStatus: "active"}] "fields": { "name" :{ "read": true}, "salary":{"read": true} }, "additional_fields": { "read": false, "write": false } userid: "101" [{ userid: "101" name: … salary: …}]
  • 26. JSON Schema schema: { bsonType: "object", required: ["userid", "email", "name"], properties: { userid: { bsonType: "objectid", description: "The ID of the Stitch user" }, email: { bsonType: "string", description: "must be a string and is required" }, name: { bsonType: "string", description: "must be a string and is required" } }
  • 27. Schema Validation schema: { bsonType: "object", required: ["userid", "email", "name"], properties: { userid: { bsonType: "objectid", description: "The ID of the Stitch user" }, email: { bsonType: "string", validate: {"%%true": { "%function": { "name": "isValid", "arguments": ["%%user", "%%this"]} }}, description: "must be a string and is not required" }, name: { bsonType: "bool", description: "True if the data is a secret" } [...]
  • 28. Streamlining Performance Performance hinges on assets evaluated in a request. § Use Filters to limit the data sent to the server and checked § Project out unnecessary fields to skip their evaluation § Use Functions run as System to avoid rules when appropriate
  • 29. Demo
  • 30. Stitch Roadmap Rules • Additional Rules Context • Function-enhanced Rules • Caching for Rules evaluation • Alerts on permissive Rules Authentication • UI Elements for Auth • Function-based Authentication • Configurable email/password confirmation flows • Apple Sign-in support Development • Automatic Github Deployment • Draft deploys for Stitch UI • Better API Creation Support • Static Hosting GA • Additional Watch() support Stitch has recently announced HIPAA and ISO compliance
  • 31. What’s Next? Get started at stitch.mongodb.com Stitch § Tutorial: Modern Web Dev with MongoDB Stitch – 12:45pm Tuesday – Naussau § Check out the Stitch POD on Wednesday! Realm § REST-less Mobile Apps – 9:00am Tuesday – Rhinelander South § Realm: The Secret Sauce for Better Mobile Apps – 3:00pm Tuesday – Murray Hill § Check out the Realm Mobile POD on Wednesday
  • 33. Titles on one line looks so much better First line of copy is not bulleted. Use bold or green font treatment to place emphasize on content. § Bullet one - use Paragraph > Increase List Level to add bullet § Bullet two – click Increase List Level again for next level bullet § Bullet three – click Increase List Level again for next level bullet