Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Auth* in Ember apps with Torii

Auth* in Ember apps with Torii

The presentation I gave at Ember.js Amsterdam on 03/10/2016.

Balint Erdi

March 10, 2016
Tweet

More Decks by Balint Erdi

Other Decks in Technology

Transcript

  1. Authentication Authentication (from Greek: αὐθεντικός authentikos, "real, genuine," from αὐθέντης

    authentes, "author") is the act of confirming the truth of an attribute of a single piece of data (a datum) claimed true by an entity.
  2. Authorization Authorization is the function of specifying access rights to

    resources related to information security and computer security in general and to access control in particular.
  3. Putting the two auths together After authenticating myself against the

    user database, I can do with my data as I please.
  4. Putting the two auths together After authenticating yourself against your

    Twitter profile, you have authorized the Pocket app to post to your timeline.
  5. After authenticating yourself against your Twitter profile, you have authorized

    the Pocket app to post to your timeline. Resource owner Service provider Consumer Access scope
  6. User Ember app Google + who are you? 1 who’s

    this guy? 2 visits 3 I’m Balint 4
  7. User Ember app Google + who are you? 1 who’s

    this guy? 2 visits 3 I’m Balint 4 The app wants these things 5
  8. User Ember app Google + who are you? 1 who’s

    this guy? 2 visits 3 I’m Balint 4 The app wants these things 5 I’m fine with that 6
  9. User Ember app Google + I’m fine with that 6

    Thanks, dude. 8 Here, keep this safe 7
  10. User Ember app Google + I’m fine with that 6

    Thanks, dude. 8 Here, keep this safe 7 Is this token legit? 9
  11. User Ember app Google + I’m fine with that 6

    Thanks, dude. 8 Here, keep this safe 7 Is this token legit? 9 It sure is. 10
  12. User Ember app Google + I’m fine with that 6

    Thanks, dude. 8 Here, keep this safe 7 Is this token legit? 9 It sure is. 10 Come on in 11
  13. User Ember app Google + 1 Is this token still

    legit? Dude, you asked me 2 slides ago 2
  14. User Ember app Google + 1 Is this token still

    legit? Dude, you asked me 2 slides ago 2 Come on in 3
  15. Providers • They provide authentication services (OAuth: service providers) •

    Some pre-defined ones in Torii • A single API method: open • Must return a promise
  16. Adapters • They pass authorization data from providers to the

    session • open, fetch and close • All must return promises
  17. Session • Stores current authentication state and data • Proxies

    all its methods to the specified adapter (for `open`, first to the provider) • Contains a state machine (isAuthenticated, isFetching, etc.) • Session management is opt-in
  18. Router DSL • Calls `checkLogin` on the application route •

    => Initiates the session • For authenticated routes, triggers `accessDenied` if session is not authenticated
  19. References • Some surprising things about OAuth 2.0 • Torii

    on Github • Introduction to Torii – Cory Forsyth’s video presentation at the Global Ember meetup • Introduction to Torii – the slides from said presentation • Using OAuth 2.0 for Client-side Web Apps – With the Google Identity Platform