Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Anton Davydov github.com/davydovanton
 twitter.com/anton_davydov davydovanton.com

Slide 3

Slide 3 text

OpenSource

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

authentication

Slide 9

Slide 9 text

typical authentication

Slide 10

Slide 10 text

• user authentication • working with current user • security • different auth ways (OTP, OmniAuth, 2FA) • simple way to use it with other frameworks

Slide 11

Slide 11 text

but in a real life we have some

Slide 12

Slide 12 text

• wasting time for typical functionality • complicated logic • magic in models/controllers • it’s hard to add new feature

Slide 13

Slide 13 text

and actually we can use…

Slide 14

Slide 14 text

devise

Slide 15

Slide 15 text

devise ❤ • popular • based on Rails engines • use only what you really need • add-ons • fast for production

Slide 16

Slide 16 text

devise • only rails • problem with custom logic • creates unnecessary raws in table • hulk • can be difficult to integrate

Slide 17

Slide 17 text

warden

Slide 18

Slide 18 text

sorcery

Slide 19

Slide 19 text

custom solution

Slide 20

Slide 20 text

custom solution ❤ • absolutely custom • works only for special cases • works good when other solutions sucks

Slide 21

Slide 21 text

• DRY in each application • spend much time for simple cases • you can write • you need to write all popular solutions custom solution

Slide 22

Slide 22 text

what problems we have • no simplicity • no flexibility • magic • only for rails

Slide 23

Slide 23 text

rodauth github.com/jeremyevans/rodauth

Slide 24

Slide 24 text

rodauth ❤ • fast • simple • easy to integrate with other frameworks • many features from the box • use only what you need

Slide 25

Slide 25 text

rodauth • little-known solution • new technology (from Jun 7, 2015) • another routing framework

Slide 26

Slide 26 text

Jeremy Evans github.com/jeremyevans

Slide 27

Slide 27 text

roda github.com/jeremyevans/roda

Slide 28

Slide 28 text

roda: general ideas • simplicity • reliability • extensibility • performance

Slide 29

Slide 29 text

# config.ru require "roda" class App < Roda route do |r| r.root do r.redirect "/hello" end # GET /hello request r.get "hello" do "Hello world!" end end end run App.freeze.app

Slide 30

Slide 30 text

# config.ru require "roda" class App < Roda route do |r| r.root do r.redirect "/hello" end # GET /hello request r.get "hello" do "Hello world!" end end end run App.freeze.app

Slide 31

Slide 31 text

# config.ru require "roda" class App < Roda route do |r| r.root do r.redirect "/hello" end # GET /hello request r.get "hello" do "Hello world!" end end end run App.freeze.app

Slide 32

Slide 32 text

# config.ru require "roda" class App < Roda route do |r| r.root do r.redirect "/hello" end # GET /hello request r.get "hello" do "Hello world!" end end end run App.freeze.app

Slide 33

Slide 33 text

rodauth: general ideas

Slide 34

Slide 34 text

security

Slide 35

Slide 35 text

simplicity

Slide 36

Slide 36 text

flexibility

Slide 37

Slide 37 text

all features

Slide 38

Slide 38 text

login logout change password change login reset password create account close account verify account confirm account remember lockout OTP recovery codes SMS codes verify change login verify account grace period password grace period password complexity disallow password reuse password expiration account expiration session expiration single session JWT (JSON API)

Slide 39

Slide 39 text

architecture

Slide 40

Slide 40 text

it’s just a plugin for roda

Slide 41

Slide 41 text

# cat config.ru require "roda" class RodauthApp < Roda plugin :rodauth do enable :login, :logout, :change_password end route do |r| r.rodauth rodauth.require_authentication end end run RodauthApp

Slide 42

Slide 42 text

# cat config.ru require "roda" class RodauthApp < Roda plugin :rodauth do enable :login, :logout, :change_password end route do |r| r.rodauth rodauth.require_authentication end end run RodauthApp

Slide 43

Slide 43 text

# cat config.ru require "roda" class RodauthApp < Roda plugin :rodauth do enable :login, :logout, :change_password end route do |r| r.rodauth rodauth.require_authentication end end run RodauthApp

Slide 44

Slide 44 text

# cat config.ru require "roda" class RodauthApp < Roda plugin :rodauth do enable :login, :logout, :change_password end route do |r| r.rodauth rodauth.require_authentication end end run RodauthApp

Slide 45

Slide 45 text

# cat config.ru require "roda" class RodauthApp < Roda plugin :rodauth do enable :login, :logout, :change_password end route do |r| r.rodauth rodauth.require_authentication end end run RodauthApp

Slide 46

Slide 46 text

how we can use rodauth with other apps

Slide 47

Slide 47 text

general idea for integration

Slide 48

Slide 48 text

use middleware

Slide 49

Slide 49 text

Rack Rodauth Your app

Slide 50

Slide 50 text

Rack Rodauth Your app

Slide 51

Slide 51 text

Rack Rodauth Your app

Slide 52

Slide 52 text

Rack environment session Rodauth Your app

Slide 53

Slide 53 text

github.com/jeremyevans/rodauth-demo-rails

Slide 54

Slide 54 text

https://git.io/vPDao

Slide 55

Slide 55 text

github.com/davydovanton/rodauth_hanami

Slide 56

Slide 56 text

github.com/davydovanton/grape-rodauth JSON auth only

Slide 57

Slide 57 text

but we live in real world and we won’t use this

Slide 58

Slide 58 text

how we can use these ideas in our apps

Slide 59

Slide 59 text

devise

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

use separate Account model instead of User/Admin

Slide 63

Slide 63 text

put all logic to separate application like admin app

Slide 64

Slide 64 text

don’t put all your logic to Model

Slide 65

Slide 65 text

bonus

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

• roda.jeremyevans.net • rodauth.jeremyevans.net • groups.google.com/forum/#!forum/ruby-roda • irc://chat.freenode.net/#roda • trailblazer and devise: goo.gl/cdANIA

Slide 68

Slide 68 text

conclusions

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

github.com/davydovanton
 twitter.com/anton_davydov davydovanton.com Thank you