19

Demystifying Warden

Embed Size (px)

DESCRIPTION

Better position yourself for understanding how devise works

Citation preview

Page 1: Demystifying Warden
Page 2: Demystifying Warden

warden

Page 3: Demystifying Warden

wardenequipping yourself to better

understand devise

Page 4: Demystifying Warden

any love for devise?

Page 5: Demystifying Warden

okay, so what is warden?

Page 6: Demystifying Warden

a mechanism for authentication in rack based ruby applications

Page 7: Demystifying Warden

Warden is upstream of some session middleware

Creates an env[‘warden’] proxy

Authentication can be shared between several Rack apps

Page 8: Demystifying Warden

sweet, why should I learn more about it?

Page 9: Demystifying Warden

• create custom light-weight authentication middleware

• share authentication between multiple Rack apps (rails & sinatra)

• better understand higher level libraries that use it (i.e. devise)

• and, well…

Page 10: Demystifying Warden

Because it’s way awesome!

Page 11: Demystifying Warden

Mission Debriefing

• user• strategy• failure app• scope

Page 12: Demystifying Warden

user – any object that can be serialized into the session marking a request authenticated.

Page 13: Demystifying Warden

strategy – a place to keep logic for a certain method of authenticating a request

Page 14: Demystifying Warden
Page 15: Demystifying Warden

failure app – a specified rack endpoint after all authentication strategies have failed

Page 16: Demystifying Warden

scope – a grouping of warden configuration settings.

WARNING! This is very oversimplified

Page 17: Demystifying Warden

env[‘warden’].user(:api)env[‘warden’].authenticated?(:admin)

Page 18: Demystifying Warden

Demo!

*crosses fingers*

Page 19: Demystifying Warden

Surprisingly nice…