Slide 1

Slide 1 text

Ideal Authentication in your JavaScript Application Meme-driven knowledge sharing. Volodymyr Rudyi Almost

Slide 2

Slide 2 text

ABOUT ME CEO of AgileVision.io and CTO of Agile Cashflow. Professionally developing software for the last 7 years. Designing architectures for SaaS solutions. AWS-Certified Solutions Architect. Creates SaaS Products Is a SaaS Product

Slide 3

Slide 3 text

Authentication — a process of verifying the identity. Air Force Photo/Paul Zadach

Slide 4

Slide 4 text

Authorization — a process of defining access policy for some resource.

Slide 5

Slide 5 text

Authentication Most likely You are doing it wrong

Slide 6

Slide 6 text

Even if not anyway... You may be in danger

Slide 7

Slide 7 text

Before you can authenticate you need to implement 1. Registration flow. 2. Password reset flow. 3. Credentials Validation 4. Error Handling 5. Error Messages 6. Localization 7. Brute-force attacks protection 8. Email templates

Slide 8

Slide 8 text

After user authenticates, you need to think about 1. “Remember me” feature 2. Deleting or blocking/suspending users 3. Event log 4. Anomaly Detection 5. MFA 6. Global logout 7. Scaling

Slide 9

Slide 9 text

Implementation Approaches Let’s see... I will write it myself

Slide 10

Slide 10 text

Pros ● Flexible Cons ● Huge effort ● Difficult to maintain ● Requires “low-level” testing ● Insecure in many cases ● Not reusable Public domain image from Wikimedia.org DIY Approach Closer Look

Slide 11

Slide 11 text

Popular Tools to Create Custom Authentication Passport.js

Slide 12

Slide 12 text

Implementation Approaches Let’s see... Pre-Packaged Platform

Slide 13

Slide 13 text

Third-party, self-hosted Pros ● Flexible, especially if open-source ● Moderate implementation effort ● Many of bugs made suffer other users (Maybe those will be fixed)

Slide 14

Slide 14 text

Third-party, self-hosted Cons ● Learning curve may be steep ● Proprietary self-hosted solutions can be expensive ● Maintenance required ● Vendor lock-in

Slide 15

Slide 15 text

Popular self-hosted authentication providers Open-source Proprietary

Slide 16

Slide 16 text

Implementation Approaches Let’s see... AaaS Solution*

Slide 17

Slide 17 text

Authentication as a Service Pros ● Almost zero time-to-market ● Per-user pricing ● Low implementation costs ● Low maintenance ● Tight integration with PaaS where applicable ● Often compliant with many regulations, even local ones

Slide 18

Slide 18 text

Authentication as a Service Cons ● Vendor lock-in ● Per-user pricing ● Availability is not under control ● A gap in support between you and your users. Anything that happens on AaaS side can’t be resolved by anyone but the owner ● Limited customization

Slide 19

Slide 19 text

Popular Authentication Services

Slide 20

Slide 20 text

What you should take into account? ● Platforms support ● Migration path ● Backup options ● Compliance ● Implementation cost ● License/subscription cost ● Implementation timeline, including security audits (Hello, Google!) ● Availability, especially past incidents ● Support

Slide 21

Slide 21 text

How to think? 1. Prefer Authentication as a Service over anything else. 2. Prefer open-source over proprietary self-hosted. 3. Do custom implementation only if there is no other choice or it’s for testing/PoC

Slide 22

Slide 22 text

Authentication Service Market Overview

Slide 23

Slide 23 text

Auth0 Overview ● Provided by a company, focused on the authentication and authorization service ● Integrates well with different platforms and languages ● Provides Hosted UI ● Client-side and server-side SDKs ● MFA Support ● Passwordless/OTP sign-in ● Self-hosted enterprise version for setups with such requirements

Slide 24

Slide 24 text

Auth0 Weaknesses ● Standalone product, thus requires additional integration to your infrastructure ● Not so fast support for lower tier subscriptions ● Powerful, but somewhat complicated ● HIPAA and other compliance is available only for enterprise license tier

Slide 25

Slide 25 text

AWS Cognito Overview ● Provided as a part of the Amazon Web Services(AWS) Platform ● Supports OIDC and SAML Federation ● Supports web, iOS and Android clients ● Provides client-side and server-side SDKs ● Deeply integrated with AWS services and can issue tokens to access ● Supports Hosted UI ● Supports MFA ● HIPAA, PCI DSS compliant out of the box ● OIDC and SAML Support

Slide 26

Slide 26 text

AWS Cognito Weaknesses ● Hosted UI is not very customizable. Only logo and several colors can be changed ● There is no such thing as action email/action link, besides the standard registration/reset flow. Invitation emails are not first class citizens ● API is very slow ● Default API rate limits are low ● Search API is not usable, unless you are happy with basic search capabilities by name and email ● Too few “ready-to-use” integrations for external systems

Slide 27

Slide 27 text

Firebase Overview ● Integrates well with the Firebase(obviously) ● Provides SDKs for many platforms, including C++ and Unity ● Flexible email configuration and email actions

Slide 28

Slide 28 text

Firebase Weaknesses ● HIPAA Compliance (there are workaro ● No SAML support out-of-the-box

Slide 29

Slide 29 text

Live coding session Almost

Slide 30

Slide 30 text

Flutter and Svelte Auth0 Example

Slide 31

Slide 31 text

Flutter Example from https://github.com/devdennysegura/flutter-auth0

Slide 32

Slide 32 text

Vue App

Slide 33

Slide 33 text

Public domain image from Wikimedia.org Bonus Slide Pricing Comparison. Rough Estimates Auth0 AWS Cognito Okta Firebase 1K $23/mo $0/mo $0/mo Free* 10K $228/mo $0/mo $200/mo Free* 50K $1140/mo $0/mo $1000/m o Free*

Slide 34

Slide 34 text

Questions?

Slide 35

Slide 35 text

Thanks! [email protected] https://agilevision.io