I Don't Care About Security (And Neither Should You)

J
I Don’t Care About
Security
(And Neither Should
You)
Joel
Lord
Summer. Sea. JavaScript.
I DON’T CARE ABOUT SECURITY
(AND NEITHER SHOULD YOU)
I Don't Care About Security (And Neither Should You)
I DON’T CARE ABOUT SECURITY
(AND NEITHER SHOULD YOU)
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
About Me
➤ Author @ Udemy, Egghead
➤ Co-organizer @ NomadJS
➤ Developer Advocate @ Red Hat
OpenShift
@joel__lord
joellord
@joel__lord #OdessaJS
Twitter Notifications!
@joel__lord #OdessaJS
I Have Stickers
@joel__lord #OdessaJS
@joel__lord #OdessaJS
@joel__lord #OdessaJS
@joel__lord #OdessaJS
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
INTRODUCING
OAUTH!
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OAuth Flows
BUT WHY ?
@joel__lord #OdessaJS
DELEGATION!
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TRADITIONAL
APPLICATIONS
▸ Browser requests a login page
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TRADITIONAL
APPLICATIONS
▸ Browser requests a login page
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TRADITIONAL
APPLICATIONS
▸ Browser requests a login page
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TRADITIONAL
APPLICATIONS
▸ Browser requests a login page
▸ Server validates on the database
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TRADITIONAL
APPLICATIONS
▸ Browser requests a login page
▸ Server validates on the database
��
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TRADITIONAL
APPLICATIONS
▸ Browser requests a login page
▸ Server validates on the database
▸ It creates a session and sends back
a cookie identifier
��
🤷
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
WHAT’S WRONG WITH
TRADITIONAL AUTHENTICATION?
▸ Multiple platforms connecting to
your application
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
WHAT’S WRONG WITH
TRADITIONAL AUTHENTICATION?
▸ Multiple platforms connecting to
your application
▸ Tightly coupled
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
WHAT’S WRONG WITH
TRADITIONAL AUTHENTICATION?
▸ Multiple platforms connecting to
your application
▸ Tightly coupled
▸ Sharing credentials to connect to a
third party API
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
WHAT’S WRONG WITH
TRADITIONAL AUTHENTICATION?
▸ Multiple platforms connecting to
your application
▸ Tightly coupled
▸ Sharing credentials to connect to a
third party API
▸ Users have a gazillions accounts
already, which leads to password
reuse and lower conversion rates
I Don't Care About Security (And Neither Should You)
OAUTH GRANTS
I DON’T CARE ABOUT SECURITY
(AND NEITHER SHOULD YOU)
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
AUTHORIZATION CODE
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
IMPLICIT GRANT
��
TOKENS 101
I DON’T CARE ABOUT SECURITY
(AND NEITHER SHOULD YOU)
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TOKENS
▸ Access Tokens
▸ Gives you access to a resource
▸ Controls access to your API
▸ Short Lived
▸ Refresh Tokens
▸ Enable you to get a new
access token
▸ Longed lived
▸ Can be revoked
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TOKENS
▸ Refresh Tokens
▸ Enable you to get a new
access token
▸ Longed lived
▸ Can be revoked
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TOKENS
▸ Refresh Tokens
▸ Enable you to get a new
access token
▸ Longed lived
▸ Can be revoked
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TOKENS
▸ WS Federated
▸ SAML
▸ Custom stuff
▸ …
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
TOKENS
▸ WS Federated
▸ SAML
▸ Custom stuff
▸ JWT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
eyJhbGciOiJIUzI1NiIsInR5cCI
6IkpXVCJ9.eyJzdWIiOiIxMjM
0NTY3ODkwIiwibmFtZSI6Ikp
vZWwgTG9yZCIsImFkbWluIj
p0cnVlLCJzY29wZSI6InBvc3R
zOnJlYWQgcG9zdHM6d3Jp
dGUifQ.XesR-pKdlscHfUwoK
vHnACqfpe2ywJ6t1BJKsq9rE
cg
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Header
▸ Payload
▸ Signature
eyJhbGciOiJIUzI1NiIsInR5cCI
6IkpXVCJ9.eyJzdWIiOiIxMjM
0NTY3ODkwIiwibmFtZSI6Ikp
vZWwgTG9yZCIsImFkbWluIj
p0cnVlLCJzY29wZSI6InBvc3R
zOnJlYWQgcG9zdHM6d3Jp
dGUifQ.XesR-pKdlscHfUwoK
vHnACqfpe2ywJ6t1BJKsq9rE
cg
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Header eyJhbGciOiJIUzI1NiIsInR5cCI
6IkpXVCJ9.eyJzdWIiOiIxMjM
0NTY3ODkwIiwibmFtZSI6Ikp
vZWwgTG9yZCIsImFkbWluIj
p0cnVlLCJzY29wZSI6InBvc3R
zOnJlYWQgcG9zdHM6d3Jp
dGUifQ.XesR-pKdlscHfUwoK
vHnACqfpe2ywJ6t1BJKsq9rE
cg
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Header eyJhbGciOiJIUzI1NiIsInR5cCI
6IkpXVCJ9
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Header atob(‘eyJhbGciOiJIUzI1NiIsIn
R5cCI6IkpXVCJ9’);
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Header {
"alg": "HS256",
"typ": "JWT"
}
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Payload eyJhbGciOiJIUzI1NiIsInR5cCI
6IkpXVCJ9.eyJzdWIiOiIxMjM
0NTY3ODkwIiwibmFtZSI6Ikp
vZWwgTG9yZCIsImFkbWluIj
p0cnVlLCJzY29wZSI6InBvc3R
zOnJlYWQgcG9zdHM6d3Jp
dGUifQ.XesR-pKdlscHfUwoK
vHnACqfpe2ywJ6t1BJKsq9rE
cg
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Payload eyJzdWIiOiIxMjM0NTY3ODk
wIiwibmFtZSI6IkpvZWwgTG9
yZCIsImFkbWluIjp0cnVlLCJzY
29wZSI6InBvc3RzOnJlYWQg
cG9zdHM6d3JpdGUifQ
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Payload atob(‘eyJzdWIiOiIxMjM0NTY
3ODkwIiwibmFtZSI6IkpvZWw
gTG9yZCIsImFkbWluIjp0cnVl
LCJzY29wZSI6InBvc3RzOnJlY
WQgcG9zdHM6d3JpdGUifQ
’);
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Payload {
"sub": "1234567890",
"name": "Joel Lord",
"admin": true,
"scope": "posts:read
posts:write"
}
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Signature XesR-pKdlscHfUwoKvHnACqf
pe2ywJ6t1BJKsq9rEcg
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
▸ Signature hmacsha256(
`${header}.${payload}`,
SECRET_KEY
);
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
JSON WEB TOKENS (JWTS, NOT JOTS)
Image: https://jwt.io
CODE TIME!
Auth Server API
var express = require('express');
var Webtask = require('webtask-tools');
var bodyParser = require('body-parser');
var randopeep = require("randopeep");
var jwt = require("jsonwebtoken");
var app = express();
var users = [
{id: 1, username: "joellord", password: "joellord"},
{id: 2, username: "guest", password: "guest"}
];
app.use(bodyParser.json());
app.post("/login", function(req, res) {
if (!req.body.username || !req.body.password) return res.status(400).send("Need username
and password");
var user = users.find(function(u) {
return u.username === req.body.username && u.password === req.body.password;
});
if (!user) return res.status(401).send("User not found");
var token = jwt.sign({
sub: user.id,
scope: "api:read",
username: user.username
}, "mysupersecret", {expiresIn: "10 minutes"});
res.status(200).send({token: token});
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
module.exports = Webtask.fromExpress(app);
var express = require('express');
var Webtask = require('webtask-tools');
var bodyParser = require('body-parser');
var jwt = require("jsonwebtoken");
var app = express();
var users = [
{id: 1, username: "joellord", password: "joellord"},
{id: 2, username: "guest", password: "guest"}
];
app.use(bodyParser.urlencoded());
app.get("/login", function(req, res) {
var loginForm = "<form method='post'><input type=hidden name=callback value='" +
req.query.callback + "'><input type=text name=username /><input type=text name=password
/><input type=submit></form>";
res.status(200).send(loginForm);
});
app.post("/login", function(req, res) {
if (!req.body.username || !req.body.password) return res.status(400).send("Need username
and password");
var user = users.find(function(u) {
return u.username === req.body.username && u.password === req.body.password;
});
if (!user) return res.status(401).send("User not found");
var token = jwt.sign({
sub: user.id,
scope: "api:read",
username: user.username
}, "mysupersecret", {expiresIn: "10 minutes"});
res.redirect(req.body.callback + "#access_token=" + token);
});
Auth Server
var express = require('express');
var bodyParser = require('body-parser');
var jwt = require("jsonwebtoken");
var app = express();
// ...
Auth Server
var express = require('express');
var bodyParser = require('body-parser');
var jwt = require("jsonwebtoken");
var app = express();
// ...
Auth Server
var express = require('express');
var bodyParser = require('body-parser');
var jwt = require("jsonwebtoken");
var app = express();
// ...
Auth Server
var express = require('express');
var bodyParser = require('body-parser');
var jwt = require("jsonwebtoken");
var app = express();
// ...
Auth Server
// Requires ...
var users = [
{id: 1, username: "joellord", password: "joellord"},
{id: 2, username: "guest", password: "guest"}
];
Auth Server
// Requires ...
var users = [...];
app.use(bodyParser.urlencoded());
app.post("/login", function(req, res) {
// POST for login
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
Auth Server
// Requires ...
var users = [...];
app.use(bodyParser.urlencoded());
app.post("/login", function(req, res) {
// POST for login
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
Auth Server
app.post("/login", function(req, res) {
// POST for login
if (!req.body.username || !req.body.password)
return res.status(400).send("Need username and password");
var user = users.find(function(u) {
return u.username === req.body.username && u.password === req.body.password;
});
if (!user) return res.status(401).send("User not found");
var token = jwt.sign({
sub: user.id,
scope: "api:read",
username: user.username
}, "mysupersecret", {expiresIn: "10 minutes"});
res.redirect(req.body.callback + "#access_token=" + token);
});
Auth Server
app.post("/login", function(req, res) {
// POST for login
if (!req.body.username || !req.body.password)
return res.status(400).send("Need username and password");
var user = users.find(function(u) {
return u.username === req.body.username && u.password === req.body.password;
});
if (!user) return res.status(401).send("User not found");
var token = jwt.sign({
sub: user.id,
scope: "api:read",
username: user.username
}, "mysupersecret", {expiresIn: "10 minutes"});
res.redirect(req.body.callback + "#access_token=" + token);
});
Auth Server
app.post("/login", function(req, res) {
// POST for login
if (!req.body.username || !req.body.password)
return res.status(400).send("Need username and password");
var user = users.find(function(u) {
return u.username === req.body.username && u.password === req.body.password;
});
if (!user) return res.status(401).send("User not found");
var token = jwt.sign({
sub: user.id,
scope: "api:read",
username: user.username
}, "mysupersecret", {expiresIn: "10 minutes"});
res.redirect(req.body.callback + "#access_token=" + token);
});
Auth Server
app.post("/login", function(req, res) {
// POST for login
if (!req.body.username || !req.body.password)
return res.status(400).send("Need username and password");
var user = users.find(function(u) {
return u.username === req.body.username && u.password === req.body.password;
});
if (!user) return res.status(401).send("User not found");
var token = jwt.sign({
sub: user.id,
scope: "api:read",
username: user.username
}, "mysupersecret", {expiresIn: "10 minutes"});
res.redirect(req.body.callback + "#access_token=" + token);
});
Auth Server
// Requires ...
var users = [...];
app.use(bodyParser.urlencoded());
app.post("/login", function(req, res) {
// POST for login
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
app.listen(8080, () => console.log("Auth server running on 8080"));}
API
var express = require('express');
var bodyParser = require('body-parser');
var randopeep = require("randopeep");
var expressjwt = require("express-jwt");
var app = express();
API
var express = require('express');
var bodyParser = require('body-parser');
var randopeep = require("randopeep");
var expressjwt = require("express-jwt");
var app = express();
API
var express = require('express');
var bodyParser = require('body-parser');
var randopeep = require("randopeep");
var expressjwt = require("express-jwt");
var app = express();
API
var express = require('express');
var bodyParser = require('body-parser');
var randopeep = require("randopeep");
var expressjwt = require("express-jwt");
var app = express();
API
var express = require('express');
var bodyParser = require('body-parser');
var randopeep = require("randopeep");
var expressjwt = require("express-jwt");
var app = express();
API
// Requires ...
var jwtCheck = expressjwt({
secret: "mysupersecret"
});
API
// Requires and config ...
app.get("/headline", function(req, res) {
// Unprotected
res.status(200).send(randopeep.clickbait.headline());
});
app.get("/protected/headline", jwtCheck, function(req, res) {
// Protected
res.status(200).send(randopeep.clickbait.headline("Joel Lord"));
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
API
// Requires and config ...
app.get("/headline", function(req, res) {
// Unprotected
res.status(200).send(randopeep.clickbait.headline());
});
app.get("/protected/headline", jwtCheck, function(req, res) {
// Protected
res.status(200).send(randopeep.clickbait.headline("Joel Lord"));
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
API
// Requires and config ...
app.get("/headline", function(req, res) {
// Unprotected
res.status(200).send(randopeep.clickbait.headline());
});
app.get("/protected/headline", jwtCheck, function(req, res) {
// Protected
res.status(200).send(randopeep.clickbait.headline("Joel Lord"));
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
API
// Requires and config ...
app.get("/headline", function(req, res) {
// Unprotected
res.status(200).send(randopeep.clickbait.headline());
});
app.get("/protected/headline", jwtCheck, function(req, res) {
// Protected
res.status(200).send(randopeep.clickbait.headline("Joel Lord"));
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
API
// Requires and config ...
app.get("/headline", function(req, res) {
// Unprotected
});
app.get("/protected/headline", jwtCheck, function(req, res) {
// Protected
});
app.get('*', function (req, res) {
res.sendStatus(404);
});
app.listen(8888, () => console.log("API listening on 8888"));
I Don't Care About Security (And Neither Should You)
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
DEAR DEMO GODS, PLEASE
LET THIS WORK
▸ https://github.com/joellord/secure-s
pa-auth0
@joel__lord #OdessaJS
DELEGATION!
I Don't Care About Security (And Neither Should You)
@joel__lord #OdessaJS
@joel__lord #OdessaJS
@joel__lord #OdessaJS
@joel__lord #OdessaJS
I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)
INTRODUCING OPEN
ID CONNECT!
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
▸ Built on top of OAuth 2.0
▸ OpenID Connect is to OpenId what JavaScript is to Java
▸ Provides Identity Tokens in JWT format
▸ Uses a /userinfo endpoint to provide this info
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
▸ Uses the “scope” to fetch info
▸ openid
▸ Profile
▸ email
▸ address
▸ phone
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
scope=openid%20profile
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
/userinfo
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
OPEN ID CONNECT
Image: https://openidconnect.net
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
DEAR DEMO GODS, PLEASE
LET THIS WORK
▸ https://github.com/joellord/secure-s
pa-auth0
@joel__lord #OdessaJS
DELEGATION!
@joel__lord #OdessaJS
@joel__lord #OdessaJS
I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
RESOURCES
▸ General JWT resource
▸ https://jwt.io/
▸ Learn how OIDC works
▸ https://openidconnect.net/
▸ Code samples
▸ http://bit.ly/idontcareaboutsecurity
@joel__lord #OdessaJS
@joel__lord
joellord
I DON’T CARE ABOUT SECURITY (AND NEITHER
SHOULD YOU)
Odessa JS
July 21, 2019
THANK YOU !
https://ezurl.to/idontcare
1 of 131

Recommended

I Don't Care About Security (And Neither Should You) by Joel lord by
I Don't Care About Security (And Neither Should You) by Joel lordI Don't Care About Security (And Neither Should You) by Joel lord
I Don't Care About Security (And Neither Should You) by Joel lordOdessaJS Conf
3.1K views129 slides
I Don't Care About Security (And Neither Should You) by
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)Joel Lord
323 views121 slides
Woobox and facebook fanpage tutorial by
Woobox and facebook fanpage tutorialWoobox and facebook fanpage tutorial
Woobox and facebook fanpage tutorialJan Gerber Navarro
512 views191 slides
How to use group me by jan by
How to use group me by jan How to use group me by jan
How to use group me by jan Jan Gerber Navarro
449 views101 slides
العلوم للصف الرابع by
العلوم للصف الرابعالعلوم للصف الرابع
العلوم للصف الرابعأمنية وجدى
2.2K views29 slides
Theroyalconnection1week hrh by
Theroyalconnection1week hrhTheroyalconnection1week hrh
Theroyalconnection1week hrhCruzeiro Safaris
169 views4 slides

More Related Content

Similar to I Don't Care About Security (And Neither Should You)

I Don't Care About Security (And Neither Should You) by
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)Joel Lord
153 views126 slides
I Don't Care About Security (And Neither Should You) by
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)Joel Lord
157 views128 slides
Je me fiche de la sécurité (vous devriez aussi) - Joel Lord by
Je me fiche de la sécurité (vous devriez aussi) - Joel LordJe me fiche de la sécurité (vous devriez aussi) - Joel Lord
Je me fiche de la sécurité (vous devriez aussi) - Joel LordWeb à Québec
448 views128 slides
I Don't Care About Security (And Neither Should You) by
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)Joel Lord
196 views98 slides
I Don't Care About Security (And Neither Should You) by
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)Joel Lord
125 views99 slides
Making Mobile Sites Faster by
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites FasterAndy Davies
23.3K views71 slides

Similar to I Don't Care About Security (And Neither Should You)(6)

I Don't Care About Security (And Neither Should You) by Joel Lord
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)
Joel Lord153 views
I Don't Care About Security (And Neither Should You) by Joel Lord
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)
Joel Lord157 views
Je me fiche de la sécurité (vous devriez aussi) - Joel Lord by Web à Québec
Je me fiche de la sécurité (vous devriez aussi) - Joel LordJe me fiche de la sécurité (vous devriez aussi) - Joel Lord
Je me fiche de la sécurité (vous devriez aussi) - Joel Lord
Web à Québec448 views
I Don't Care About Security (And Neither Should You) by Joel Lord
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)
Joel Lord196 views
I Don't Care About Security (And Neither Should You) by Joel Lord
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)
Joel Lord125 views
Making Mobile Sites Faster by Andy Davies
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites Faster
Andy Davies23.3K views

More from Joel Lord

From Ceasar Cipher To Quantum Cryptography by
From Ceasar Cipher To Quantum CryptographyFrom Ceasar Cipher To Quantum Cryptography
From Ceasar Cipher To Quantum CryptographyJoel Lord
405 views185 slides
Forgot Password? Yes I Did! by
Forgot Password? Yes I Did!Forgot Password? Yes I Did!
Forgot Password? Yes I Did!Joel Lord
432 views61 slides
Mot de passe oublié? Absolument! by
Mot de passe oublié? Absolument!Mot de passe oublié? Absolument!
Mot de passe oublié? Absolument!Joel Lord
193 views69 slides
Asynchronicity: concurrency. A tale of by
Asynchronicity: concurrency. A tale ofAsynchronicity: concurrency. A tale of
Asynchronicity: concurrency. A tale ofJoel Lord
283 views176 slides
Learning Machine Learning by
Learning Machine LearningLearning Machine Learning
Learning Machine LearningJoel Lord
452 views45 slides
Forgot Password? Yes I Did! by
Forgot Password? Yes I Did!Forgot Password? Yes I Did!
Forgot Password? Yes I Did!Joel Lord
295 views66 slides

More from Joel Lord(20)

From Ceasar Cipher To Quantum Cryptography by Joel Lord
From Ceasar Cipher To Quantum CryptographyFrom Ceasar Cipher To Quantum Cryptography
From Ceasar Cipher To Quantum Cryptography
Joel Lord405 views
Forgot Password? Yes I Did! by Joel Lord
Forgot Password? Yes I Did!Forgot Password? Yes I Did!
Forgot Password? Yes I Did!
Joel Lord432 views
Mot de passe oublié? Absolument! by Joel Lord
Mot de passe oublié? Absolument!Mot de passe oublié? Absolument!
Mot de passe oublié? Absolument!
Joel Lord193 views
Asynchronicity: concurrency. A tale of by Joel Lord
Asynchronicity: concurrency. A tale ofAsynchronicity: concurrency. A tale of
Asynchronicity: concurrency. A tale of
Joel Lord283 views
Learning Machine Learning by Joel Lord
Learning Machine LearningLearning Machine Learning
Learning Machine Learning
Joel Lord452 views
Forgot Password? Yes I Did! by Joel Lord
Forgot Password? Yes I Did!Forgot Password? Yes I Did!
Forgot Password? Yes I Did!
Joel Lord295 views
WTH is a JWT by Joel Lord
WTH is a JWTWTH is a JWT
WTH is a JWT
Joel Lord909 views
Forgot Password? Yes I Did! by Joel Lord
Forgot Password? Yes I Did!Forgot Password? Yes I Did!
Forgot Password? Yes I Did!
Joel Lord115 views
WTH is a JWT by Joel Lord
WTH is a JWTWTH is a JWT
WTH is a JWT
Joel Lord311 views
Asynchonicity: concurrency. A tale of by Joel Lord
Asynchonicity: concurrency. A tale ofAsynchonicity: concurrency. A tale of
Asynchonicity: concurrency. A tale of
Joel Lord360 views
I Don't Care About Security by Joel Lord
I Don't Care About Security I Don't Care About Security
I Don't Care About Security
Joel Lord247 views
I Don't Care About Security (And Neither Should You) by Joel Lord
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)
Joel Lord209 views
I Don't Care About Security (And Neither Should You) by Joel Lord
I Don't Care About Security (And Neither Should You)I Don't Care About Security (And Neither Should You)
I Don't Care About Security (And Neither Should You)
Joel Lord233 views
Secure your SPA with Auth0 by Joel Lord
Secure your SPA with Auth0Secure your SPA with Auth0
Secure your SPA with Auth0
Joel Lord341 views
Learning Machine Learning by Joel Lord
Learning Machine LearningLearning Machine Learning
Learning Machine Learning
Joel Lord343 views
Learning Machine Learning by Joel Lord
Learning Machine LearningLearning Machine Learning
Learning Machine Learning
Joel Lord241 views
Rise of the Nodebots by Joel Lord
Rise of the NodebotsRise of the Nodebots
Rise of the Nodebots
Joel Lord262 views
Let's Get Physical by Joel Lord
Let's Get PhysicalLet's Get Physical
Let's Get Physical
Joel Lord279 views
Learning About Machine Learning by Joel Lord
Learning About Machine LearningLearning About Machine Learning
Learning About Machine Learning
Joel Lord308 views
Learning About Machine Learning by Joel Lord
Learning About Machine LearningLearning About Machine Learning
Learning About Machine Learning
Joel Lord245 views

Recently uploaded

40th TWNIC Open Policy Meeting: A quick look at QUIC by
40th TWNIC Open Policy Meeting: A quick look at QUIC40th TWNIC Open Policy Meeting: A quick look at QUIC
40th TWNIC Open Policy Meeting: A quick look at QUICAPNIC
109 views20 slides
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download by
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink DownloadAPNIC
112 views30 slides
ARNAB12.pdf by
ARNAB12.pdfARNAB12.pdf
ARNAB12.pdfArnabChakraborty499766
5 views83 slides
hamro digital logics.pptx by
hamro digital logics.pptxhamro digital logics.pptx
hamro digital logics.pptxtupeshghimire
11 views36 slides
Penetration Testing for Cybersecurity Professionals by
Penetration Testing for Cybersecurity ProfessionalsPenetration Testing for Cybersecurity Professionals
Penetration Testing for Cybersecurity Professionals211 Check
49 views17 slides
WITS Deck by
WITS DeckWITS Deck
WITS DeckW.I.T.S.
36 views22 slides

Recently uploaded(13)

40th TWNIC Open Policy Meeting: A quick look at QUIC by APNIC
40th TWNIC Open Policy Meeting: A quick look at QUIC40th TWNIC Open Policy Meeting: A quick look at QUIC
40th TWNIC Open Policy Meeting: A quick look at QUIC
APNIC109 views
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download by APNIC
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download
APNIC112 views
Penetration Testing for Cybersecurity Professionals by 211 Check
Penetration Testing for Cybersecurity ProfessionalsPenetration Testing for Cybersecurity Professionals
Penetration Testing for Cybersecurity Professionals
211 Check49 views
WITS Deck by W.I.T.S.
WITS DeckWITS Deck
WITS Deck
W.I.T.S.36 views
The Dark Web : Hidden Services by Anshu Singh
The Dark Web : Hidden ServicesThe Dark Web : Hidden Services
The Dark Web : Hidden Services
Anshu Singh22 views
cis5-Project-11a-Harry Lai by harrylai126
cis5-Project-11a-Harry Laicis5-Project-11a-Harry Lai
cis5-Project-11a-Harry Lai
harrylai1269 views
40th TWNIC Open Policy Meeting: APNIC PDP update by APNIC
40th TWNIC Open Policy Meeting: APNIC PDP update40th TWNIC Open Policy Meeting: APNIC PDP update
40th TWNIC Open Policy Meeting: APNIC PDP update
APNIC106 views
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx by LeasedLinesQuote
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptxCracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
ATPMOUSE_융합2조.pptx by kts120898
ATPMOUSE_융합2조.pptxATPMOUSE_융합2조.pptx
ATPMOUSE_융합2조.pptx
kts12089835 views

I Don't Care About Security (And Neither Should You)

  • 1. I Don’t Care About Security (And Neither Should You) Joel Lord Summer. Sea. JavaScript.
  • 2. I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
  • 4. I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
  • 5. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) About Me ➤ Author @ Udemy, Egghead ➤ Co-organizer @ NomadJS ➤ Developer Advocate @ Red Hat OpenShift @joel__lord joellord
  • 12. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 13. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 14. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 15. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 17. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 18. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 19. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 20. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 21. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 22. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OAuth Flows
  • 25. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TRADITIONAL APPLICATIONS ▸ Browser requests a login page
  • 26. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TRADITIONAL APPLICATIONS ▸ Browser requests a login page
  • 27. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TRADITIONAL APPLICATIONS ▸ Browser requests a login page
  • 28. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TRADITIONAL APPLICATIONS ▸ Browser requests a login page ▸ Server validates on the database
  • 29. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TRADITIONAL APPLICATIONS ▸ Browser requests a login page ▸ Server validates on the database ��
  • 30. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TRADITIONAL APPLICATIONS ▸ Browser requests a login page ▸ Server validates on the database ▸ It creates a session and sends back a cookie identifier ��
  • 31. 🤷
  • 32. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) WHAT’S WRONG WITH TRADITIONAL AUTHENTICATION? ▸ Multiple platforms connecting to your application
  • 33. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) WHAT’S WRONG WITH TRADITIONAL AUTHENTICATION? ▸ Multiple platforms connecting to your application ▸ Tightly coupled
  • 34. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) WHAT’S WRONG WITH TRADITIONAL AUTHENTICATION? ▸ Multiple platforms connecting to your application ▸ Tightly coupled ▸ Sharing credentials to connect to a third party API
  • 35. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) WHAT’S WRONG WITH TRADITIONAL AUTHENTICATION? ▸ Multiple platforms connecting to your application ▸ Tightly coupled ▸ Sharing credentials to connect to a third party API ▸ Users have a gazillions accounts already, which leads to password reuse and lower conversion rates
  • 37. OAUTH GRANTS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
  • 38. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 39. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 40. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 41. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 42. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 43. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 44. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 45. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 46. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 47. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 48. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 49. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 50. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) AUTHORIZATION CODE
  • 51. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT
  • 52. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT
  • 53. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT
  • 54. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT
  • 55. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT
  • 56. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT
  • 57. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT
  • 58. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT
  • 59. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) IMPLICIT GRANT ��
  • 60. TOKENS 101 I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU)
  • 61. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TOKENS ▸ Access Tokens ▸ Gives you access to a resource ▸ Controls access to your API ▸ Short Lived ▸ Refresh Tokens ▸ Enable you to get a new access token ▸ Longed lived ▸ Can be revoked
  • 62. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TOKENS ▸ Refresh Tokens ▸ Enable you to get a new access token ▸ Longed lived ▸ Can be revoked
  • 63. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TOKENS ▸ Refresh Tokens ▸ Enable you to get a new access token ▸ Longed lived ▸ Can be revoked
  • 64. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TOKENS ▸ WS Federated ▸ SAML ▸ Custom stuff ▸ …
  • 65. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) TOKENS ▸ WS Federated ▸ SAML ▸ Custom stuff ▸ JWT
  • 66. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) eyJhbGciOiJIUzI1NiIsInR5cCI 6IkpXVCJ9.eyJzdWIiOiIxMjM 0NTY3ODkwIiwibmFtZSI6Ikp vZWwgTG9yZCIsImFkbWluIj p0cnVlLCJzY29wZSI6InBvc3R zOnJlYWQgcG9zdHM6d3Jp dGUifQ.XesR-pKdlscHfUwoK vHnACqfpe2ywJ6t1BJKsq9rE cg
  • 67. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Header ▸ Payload ▸ Signature eyJhbGciOiJIUzI1NiIsInR5cCI 6IkpXVCJ9.eyJzdWIiOiIxMjM 0NTY3ODkwIiwibmFtZSI6Ikp vZWwgTG9yZCIsImFkbWluIj p0cnVlLCJzY29wZSI6InBvc3R zOnJlYWQgcG9zdHM6d3Jp dGUifQ.XesR-pKdlscHfUwoK vHnACqfpe2ywJ6t1BJKsq9rE cg
  • 68. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Header eyJhbGciOiJIUzI1NiIsInR5cCI 6IkpXVCJ9.eyJzdWIiOiIxMjM 0NTY3ODkwIiwibmFtZSI6Ikp vZWwgTG9yZCIsImFkbWluIj p0cnVlLCJzY29wZSI6InBvc3R zOnJlYWQgcG9zdHM6d3Jp dGUifQ.XesR-pKdlscHfUwoK vHnACqfpe2ywJ6t1BJKsq9rE cg
  • 69. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Header eyJhbGciOiJIUzI1NiIsInR5cCI 6IkpXVCJ9
  • 70. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Header atob(‘eyJhbGciOiJIUzI1NiIsIn R5cCI6IkpXVCJ9’);
  • 71. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Header { "alg": "HS256", "typ": "JWT" }
  • 72. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Payload eyJhbGciOiJIUzI1NiIsInR5cCI 6IkpXVCJ9.eyJzdWIiOiIxMjM 0NTY3ODkwIiwibmFtZSI6Ikp vZWwgTG9yZCIsImFkbWluIj p0cnVlLCJzY29wZSI6InBvc3R zOnJlYWQgcG9zdHM6d3Jp dGUifQ.XesR-pKdlscHfUwoK vHnACqfpe2ywJ6t1BJKsq9rE cg
  • 73. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Payload eyJzdWIiOiIxMjM0NTY3ODk wIiwibmFtZSI6IkpvZWwgTG9 yZCIsImFkbWluIjp0cnVlLCJzY 29wZSI6InBvc3RzOnJlYWQg cG9zdHM6d3JpdGUifQ
  • 74. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Payload atob(‘eyJzdWIiOiIxMjM0NTY 3ODkwIiwibmFtZSI6IkpvZWw gTG9yZCIsImFkbWluIjp0cnVl LCJzY29wZSI6InBvc3RzOnJlY WQgcG9zdHM6d3JpdGUifQ ’);
  • 75. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Payload { "sub": "1234567890", "name": "Joel Lord", "admin": true, "scope": "posts:read posts:write" }
  • 76. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Signature XesR-pKdlscHfUwoKvHnACqf pe2ywJ6t1BJKsq9rEcg
  • 77. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) ▸ Signature hmacsha256( `${header}.${payload}`, SECRET_KEY );
  • 78. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) JSON WEB TOKENS (JWTS, NOT JOTS) Image: https://jwt.io
  • 80. Auth Server API var express = require('express'); var Webtask = require('webtask-tools'); var bodyParser = require('body-parser'); var randopeep = require("randopeep"); var jwt = require("jsonwebtoken"); var app = express(); var users = [ {id: 1, username: "joellord", password: "joellord"}, {id: 2, username: "guest", password: "guest"} ]; app.use(bodyParser.json()); app.post("/login", function(req, res) { if (!req.body.username || !req.body.password) return res.status(400).send("Need username and password"); var user = users.find(function(u) { return u.username === req.body.username && u.password === req.body.password; }); if (!user) return res.status(401).send("User not found"); var token = jwt.sign({ sub: user.id, scope: "api:read", username: user.username }, "mysupersecret", {expiresIn: "10 minutes"}); res.status(200).send({token: token}); }); app.get('*', function (req, res) { res.sendStatus(404); }); module.exports = Webtask.fromExpress(app); var express = require('express'); var Webtask = require('webtask-tools'); var bodyParser = require('body-parser'); var jwt = require("jsonwebtoken"); var app = express(); var users = [ {id: 1, username: "joellord", password: "joellord"}, {id: 2, username: "guest", password: "guest"} ]; app.use(bodyParser.urlencoded()); app.get("/login", function(req, res) { var loginForm = "<form method='post'><input type=hidden name=callback value='" + req.query.callback + "'><input type=text name=username /><input type=text name=password /><input type=submit></form>"; res.status(200).send(loginForm); }); app.post("/login", function(req, res) { if (!req.body.username || !req.body.password) return res.status(400).send("Need username and password"); var user = users.find(function(u) { return u.username === req.body.username && u.password === req.body.password; }); if (!user) return res.status(401).send("User not found"); var token = jwt.sign({ sub: user.id, scope: "api:read", username: user.username }, "mysupersecret", {expiresIn: "10 minutes"}); res.redirect(req.body.callback + "#access_token=" + token); });
  • 81. Auth Server var express = require('express'); var bodyParser = require('body-parser'); var jwt = require("jsonwebtoken"); var app = express(); // ...
  • 82. Auth Server var express = require('express'); var bodyParser = require('body-parser'); var jwt = require("jsonwebtoken"); var app = express(); // ...
  • 83. Auth Server var express = require('express'); var bodyParser = require('body-parser'); var jwt = require("jsonwebtoken"); var app = express(); // ...
  • 84. Auth Server var express = require('express'); var bodyParser = require('body-parser'); var jwt = require("jsonwebtoken"); var app = express(); // ...
  • 85. Auth Server // Requires ... var users = [ {id: 1, username: "joellord", password: "joellord"}, {id: 2, username: "guest", password: "guest"} ];
  • 86. Auth Server // Requires ... var users = [...]; app.use(bodyParser.urlencoded()); app.post("/login", function(req, res) { // POST for login }); app.get('*', function (req, res) { res.sendStatus(404); });
  • 87. Auth Server // Requires ... var users = [...]; app.use(bodyParser.urlencoded()); app.post("/login", function(req, res) { // POST for login }); app.get('*', function (req, res) { res.sendStatus(404); });
  • 88. Auth Server app.post("/login", function(req, res) { // POST for login if (!req.body.username || !req.body.password) return res.status(400).send("Need username and password"); var user = users.find(function(u) { return u.username === req.body.username && u.password === req.body.password; }); if (!user) return res.status(401).send("User not found"); var token = jwt.sign({ sub: user.id, scope: "api:read", username: user.username }, "mysupersecret", {expiresIn: "10 minutes"}); res.redirect(req.body.callback + "#access_token=" + token); });
  • 89. Auth Server app.post("/login", function(req, res) { // POST for login if (!req.body.username || !req.body.password) return res.status(400).send("Need username and password"); var user = users.find(function(u) { return u.username === req.body.username && u.password === req.body.password; }); if (!user) return res.status(401).send("User not found"); var token = jwt.sign({ sub: user.id, scope: "api:read", username: user.username }, "mysupersecret", {expiresIn: "10 minutes"}); res.redirect(req.body.callback + "#access_token=" + token); });
  • 90. Auth Server app.post("/login", function(req, res) { // POST for login if (!req.body.username || !req.body.password) return res.status(400).send("Need username and password"); var user = users.find(function(u) { return u.username === req.body.username && u.password === req.body.password; }); if (!user) return res.status(401).send("User not found"); var token = jwt.sign({ sub: user.id, scope: "api:read", username: user.username }, "mysupersecret", {expiresIn: "10 minutes"}); res.redirect(req.body.callback + "#access_token=" + token); });
  • 91. Auth Server app.post("/login", function(req, res) { // POST for login if (!req.body.username || !req.body.password) return res.status(400).send("Need username and password"); var user = users.find(function(u) { return u.username === req.body.username && u.password === req.body.password; }); if (!user) return res.status(401).send("User not found"); var token = jwt.sign({ sub: user.id, scope: "api:read", username: user.username }, "mysupersecret", {expiresIn: "10 minutes"}); res.redirect(req.body.callback + "#access_token=" + token); });
  • 92. Auth Server // Requires ... var users = [...]; app.use(bodyParser.urlencoded()); app.post("/login", function(req, res) { // POST for login }); app.get('*', function (req, res) { res.sendStatus(404); }); app.listen(8080, () => console.log("Auth server running on 8080"));}
  • 93. API var express = require('express'); var bodyParser = require('body-parser'); var randopeep = require("randopeep"); var expressjwt = require("express-jwt"); var app = express();
  • 94. API var express = require('express'); var bodyParser = require('body-parser'); var randopeep = require("randopeep"); var expressjwt = require("express-jwt"); var app = express();
  • 95. API var express = require('express'); var bodyParser = require('body-parser'); var randopeep = require("randopeep"); var expressjwt = require("express-jwt"); var app = express();
  • 96. API var express = require('express'); var bodyParser = require('body-parser'); var randopeep = require("randopeep"); var expressjwt = require("express-jwt"); var app = express();
  • 97. API var express = require('express'); var bodyParser = require('body-parser'); var randopeep = require("randopeep"); var expressjwt = require("express-jwt"); var app = express();
  • 98. API // Requires ... var jwtCheck = expressjwt({ secret: "mysupersecret" });
  • 99. API // Requires and config ... app.get("/headline", function(req, res) { // Unprotected res.status(200).send(randopeep.clickbait.headline()); }); app.get("/protected/headline", jwtCheck, function(req, res) { // Protected res.status(200).send(randopeep.clickbait.headline("Joel Lord")); }); app.get('*', function (req, res) { res.sendStatus(404); });
  • 100. API // Requires and config ... app.get("/headline", function(req, res) { // Unprotected res.status(200).send(randopeep.clickbait.headline()); }); app.get("/protected/headline", jwtCheck, function(req, res) { // Protected res.status(200).send(randopeep.clickbait.headline("Joel Lord")); }); app.get('*', function (req, res) { res.sendStatus(404); });
  • 101. API // Requires and config ... app.get("/headline", function(req, res) { // Unprotected res.status(200).send(randopeep.clickbait.headline()); }); app.get("/protected/headline", jwtCheck, function(req, res) { // Protected res.status(200).send(randopeep.clickbait.headline("Joel Lord")); }); app.get('*', function (req, res) { res.sendStatus(404); });
  • 102. API // Requires and config ... app.get("/headline", function(req, res) { // Unprotected res.status(200).send(randopeep.clickbait.headline()); }); app.get("/protected/headline", jwtCheck, function(req, res) { // Protected res.status(200).send(randopeep.clickbait.headline("Joel Lord")); }); app.get('*', function (req, res) { res.sendStatus(404); });
  • 103. API // Requires and config ... app.get("/headline", function(req, res) { // Unprotected }); app.get("/protected/headline", jwtCheck, function(req, res) { // Protected }); app.get('*', function (req, res) { res.sendStatus(404); }); app.listen(8888, () => console.log("API listening on 8888"));
  • 105. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) DEAR DEMO GODS, PLEASE LET THIS WORK ▸ https://github.com/joellord/secure-s pa-auth0
  • 115. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT ▸ Built on top of OAuth 2.0 ▸ OpenID Connect is to OpenId what JavaScript is to Java ▸ Provides Identity Tokens in JWT format ▸ Uses a /userinfo endpoint to provide this info
  • 116. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT ▸ Uses the “scope” to fetch info ▸ openid ▸ Profile ▸ email ▸ address ▸ phone
  • 117. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT scope=openid%20profile
  • 118. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT
  • 119. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT
  • 120. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT
  • 121. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT
  • 122. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT
  • 123. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT /userinfo
  • 124. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT
  • 125. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) OPEN ID CONNECT Image: https://openidconnect.net
  • 126. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) DEAR DEMO GODS, PLEASE LET THIS WORK ▸ https://github.com/joellord/secure-s pa-auth0
  • 129. @joel__lord #OdessaJS I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) RESOURCES ▸ General JWT resource ▸ https://jwt.io/ ▸ Learn how OIDC works ▸ https://openidconnect.net/ ▸ Code samples ▸ http://bit.ly/idontcareaboutsecurity
  • 131. @joel__lord joellord I DON’T CARE ABOUT SECURITY (AND NEITHER SHOULD YOU) Odessa JS July 21, 2019 THANK YOU ! https://ezurl.to/idontcare