Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Going Password-Free
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Eric Mann
February 03, 2017
Technology
230
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Going Password-Free
Passwordless authentication via Tozny as presented at SunshinePHP 2017
Eric Mann
February 03, 2017
More Decks by Eric Mann
See All by Eric Mann
Kubernetes for PHP Developers: From Docker Compose to Production
ericmann
0
73
Semantic Search and Embeddings: Modernizing PHP Search with Vector Databases
ericmann
0
74
Evolution of PHP Security
ericmann
0
150
PHP, Meet AI
ericmann
0
120
Asynchronous Awesome
ericmann
0
230
WordPress, Meet AI
ericmann
0
93
Cooking with Credentials
ericmann
0
80
OWASP Top Ten in Review
ericmann
0
89
Monkeys in the Machine
ericmann
0
240
Other Decks in Technology
See All in Technology
全社に広がるMCPサーバーを、 どう安全に管理するか MCPass開発の舞台裏
mtpooh
3
270
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
130
bet_ai_day_2026_session02
agenticsec
1
790
AIエージェントを雇う前に決める5つのこと
knishioka
1
150
When Does a Local Qwen Start to Break
morshoto
0
150
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
200
Guerilla InnerSource in enterprises, during the AI hype
onenashev
PRO
0
140
全員がプロダクトへ向き合う組織を持続成長させるために——組織づくりのフライホイールと4象限 / The Flywheel Model and Four Quadrants for Organizational Design
hiro_torii
3
660
20260903 Tokyo Jazug Night #62 | Azure エンジニアよ、 その環境は本当にセキュアか?
olivia_0707
1
580
こんなアーキテクチャ図は嫌だ BEYOND THE TIME: 半年後の自分へ贈る15のメッセージ / 15 of Anti-pattern in AWS Architecture Diagrams
naospon
2
190
Kiro Crewしか勝たん!?
miu_crescent
PRO
0
160
多摩川(.dev)ランニング入門 / Tamagawa.dev#3
fujiwara3
3
300
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1033
470k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Abbi's Birthday
coloredviolet
3
9.7k
30 Presentation Tips
portentint
PRO
1
380
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
710
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
230
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
590
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
410
The Spectacular Lies of Maps
axbom
PRO
1
970
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
460
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
490
Transcript
Going Password-Free Sunshine PHP 2017
90
19
hunter2
None
How can we fix it? Password managers help Password strength
meters (zxcvbn) help Two-factor authentication helps But why require a password at all?
None
A PHP Example Defer to a 3rd party for email
& validation Use the SlimPHP framework for quick bootstrapping Allow either password or password-less authentication
Authentication Provider Free developer preview Powers both link-based and push-based
auth Supports PHP (and other langs)
Endpoints $app->get('/', function($request, $response, $args) { // Render index view
return $this->renderer->render($response, 'index.phtml', $args); }); $app->get('/register', function($request, $response, $args) { // Render registration view return $this->renderer->render($response, ‘register.phtml', $args); }); $app->get('/authenticated', function($request, $response, $args) { // Render protected view return $this->renderer->render($response, ‘authenticated.phtml', $args); });
Endpoints $app->get('/authenticated', function($request, $response, $args) { if ( !
isset( $_SESSION['username'] ) || ! $this->users->get( $_SESSION['username'] ) ) { return $response->withRedirect('/?error=notloggedin'); } // Render protected view return $this->renderer->render($response, ‘authenticated.phtml', $args); });
Endpoints $app->any('/login', function($request, $response, $args) { return $response->withRedirect('/?error=invalidlogin'); }); $app->get('/logout',
function($request, $response, $args) { session_destroy(); return $response->withRedirect('/?loggedout'); });
None
Middleware class PasswordAuth { private $c; public function __construct($cont)
{$this->c = $cont;} public function __invoke($req, $res, $next) { $user = $req->getParam(‘username’); $pass = $req->getParam(‘password’); if (empty($u) || empty($p)) return $res = $next($req, res); if ($this->c->validAuth($user, $pass)) { $_SESSION[‘username’] = $user; return $res = $res->withRedirect(‘/authenticated’); } return $res = $res->withRedirect(‘/?error=invalidlogin’); } }
Endpoints $app->any('/login', function($request, $response, $args) { return $response->withRedirect('/?error=invalidlogin'); })->add(new PasswordAuth($container));
Endpoints $app->any('/login', function($request, $response, $args) { if($request->getParam(‘magiclink’) && $request->getParam(‘username’)) {
$user = $this->users->get($request->getParam(‘username’)); $sent = sendMagicLink($user->email); if(‘ok’ === $sent[‘return’]) return $response->withRedirect(‘/?message=checkemail’); } return $response->withRedirect('/?error=invalidlogin'); })->add(new PasswordAuth($container));
Middleware class MagicLinkAuth { private $c; public function __construct($cont)
{$this->c = $cont;} public function __invoke($req, $res, $next) { $toznyo = $req->getParam(‘toznyo’); $toznyr = $req->getParam(‘toznyr’); if (empty($toznyo) || empty($toznyr)) { $res = $next($req, res); } else { if ($this->c->validLink($toznyo, $toznyr) { $user = $this->c->users->getUserFromLink($toznyo); $_SESSION[‘username’] = $user->username; $res = $res->withRedirect(‘/authenticated’); } } return $res; } }
Endpoints $app->any('/login', function($request, $response, $args) { return $response->withRedirect('/?error=invalidlogin'); })->add(new PasswordAuth($container))->add(new
MagicLinkAuth($container));
What just happened? Registered users can authenticate with their password
Registered users can request a secure, one-time login link sent to their inbox The application doesn’t care which way the users authenticate
How does this benefit us? One less password for users
to remember More flexible authentication schemes for existing users The middleware stack could be further extended to support TOTP/HOTP/ U2F/etc
What are the risks? Your users’ accounts are only as
secure as their email
Questions?
Thank You! Eric Mann - @ericmann - http://eam.me/10v - https://tozny.com