Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><img src="https://i.stack.imgur.com/tE8qw.png" alt="enter image description here"></p> <p>** <a href="https://github.com/PureKrome/WorldDomination.Web.Authentication" rel="nofollow noreferrer">Clicky-click for da GitHub project</a> **</p> <p>IMO, forget storing usernames and passwords. That's crazy talk! Let people login with their Facebook, Google or Twitter credentials. That's the 80%'s for the common websites.</p> <p>Authentication and storing the credentials are two different tasks IMO. For example, I don't care where you authenticate against .. and once you do .. I don't care how you store that data :)</p> <p>Personally, I would store it in a RavenDb .. but that's my personal choice.</p> <p>As such -> keeping these two tasks SEPARATE is (IMO) crucial. </p> <p><img src="https://i.stack.imgur.com/l9Ckw.jpg" alt="enter image description here"></p> <p>So <a href="https://github.com/PureKrome/WorldDomination.Web.Authentication/blob/master/Samples/WorldDomination.Web.Authentication.Test.Mvc.Advanced/Controllers/HomeController.cs#L59" rel="nofollow noreferrer">lets look at some codez</a> ....</p> <pre><code>public ActionResult AuthenticateCallback(string providerKey) { // SNIP SNIP SNIP SNIP var model = new AuthenticateCallbackViewModel(); try { // SNIP SNIP SNIP SNIP // Complete the authentication process by retrieving the UserInformation from the provider. model.AuthenticatedClient = _authenticationService.CheckCallback(providerKey, Request.Params, state.ToString()); // Create a new user account or update an existing account. // Whatever you end up doing, this is the part u want to // pass this data to your repository (eg. RavenDb, Sql Server, etc) // I'll use RavenDb in this example... // And yes .. this is a contrite example. U might want to check for // existing email or id or whatever u need to do, etc. var myUser = Mapper.Map(model.AuthenticatedClient); session.Store(myUser); session.SaveChanges(); // SNIP SNIP SNIP SNIP } catch (Exception exception) { model.Exception = exception; } return View(model); } </code></pre> <p>So lets look at what I've done. I've snipped out any verbose stuff (value checks, etc) which are just noise in this SO answer.</p> <p>First, I handle the Authenticate callback. Eg. I've just gone to Facebook and it's said 'yes! you ARE you' .. and it's coming back to my website, with some data i've asked it to give me.</p> <p>Next... we are given some data from Facebook .. but this might not be in the format we want to put it into, in RavenDb. So i convert it from the old format to a new shiney <code>User</code> class which is what you'll stick in your Db.</p> <p>Third - I store this in the Db. <strong>This is where you would do any custom DB logic</strong></p> <p>that's it.</p> <blockquote> <blockquote> <p>M O D U L A R I Z E T H A T S H I T</p> </blockquote> </blockquote> <p>The.End.</p> <p>Now excuse me .. there's a few hours left before The Apocalypse. I must prepare myself.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload