Successfully reported this slideshow.
Your SlideShare is downloading. ×

Introduce warden

Check these out next

1 of 15 Ad
1 of 15 Ad
Advertisement

More Related Content

Viewers also liked (18)

Advertisement
Advertisement

Introduce warden

  1. 1. Introduce to Warden @hieuk09
  2. 2. about(me) • @hieuk09 • Ruby Developer at TINYpulse
  3. 3. Why warden?
  4. 4. A peek at Devise • 3178 commits • 8311 LOC • ~70 dependencies • Only compatible with Rails
  5. 5. Warden • A devise dependencies • 287 commits • 733 LOC • ~ 20 dependencies • Compatible with all Rack applications
  6. 6. What is warden? • “Warden provides a mechanism for authentication in Rack based Ruby applications"
  7. 7. Some concepts • Strategy • Failure • Callback • User & Scope • Session
  8. 8. Strategy • How you authenticate • Password • OAuth • Implement 2 methods: valid? & authenticate!
  9. 9. Failure • A rack endpoint • Handle failure for authentication • In short: throw(:warden)
  10. 10. Callback • Provide various callbacks to hook into in authentication cycle (set user, authenticate success, failure, …) • Behave similar to Rails callbacks
  11. 11. User & Scope • Set & get user simply by set_user and user • Scope of user for some scenarios: • Multiple roles • Stimulate another user
  12. 12. Session • Store user data in separate scope • Access through session • Work like a simple hash
  13. 13. Demo & Explain
  14. 14. Reference • https://github.com/hassox/warden/wiki • https://rossta.net/blog/what-i-learned-about-hanami.html • http://pothibo.com/2013/07/authentication-with-warden- devise-less/ • Demo code • https://github.com/hieuk09/code_commenter • https://github.com/hieuk09/code-commenter-hanami

×