Andifthatuseriscorrectwiththeemailpassword, whatthey'regonnadoisthey'reactuallygonnastorethatuserinsidethesession, whichisstoredinthememoryoftheserver, andthey'regonnaget a unique I.
D.
Thatcorrespondswiththatpartinmemory.
Andthey'regoingtosendthat I d backtothebrowserusing a cookiesothatthebrowseralwayshasthatsession I d.
Whichisgreat, becauseitmeansyoucanusethesameJasonWebbtokenacrossthemultipleserversthatyourunwithouthavingtorunintoproblemswhereoneserverhas a certainsessionandtheotherserverdoesn't.
I'm gonnagointo a lotmoredeathonwhythisisreallyimportantandhowthismixture a DVTsopowerfullaterinthisvideo.
Butnext, I wanttoshowyouexactlyhowJWTactuallysignsit's tokensandhowitcanstoretheuserinformation.
Here I amon a sitecalled J w t dotio.
And I'm gonnalinkthisinthedescriptionsoyoucanmessaroundwithityourselfifyouwant.
Ifyouwanttoactuallyexpiretokensandyouwillnotice a lotoftokenswillalsohavesomethingcalled E X, P E, or E 80 whichisgoingtostandforexpiredat.
Andthisisjustthedatethatthetokennolongerbecomes a valid, andit's important a lotoftimestohaveanexpireddateonyourtokens, becauseotherwisesomeoneelsecouldtakeyourtokenandusethattoauthorizethemselvesasyou.
Thisreallyessentiallyworks a lotlikepasswordhashinginthefactthattheheaderappearandthepayloadareactuallycombinedtogetherandthenhashedin a waythattheycannotbeunhatchedandthewaythatitcheckshere.
Andifyouhave a normalsessionbasedserver, whathappensisyoursessionisstoredhereinsideofthebankandnotinsideoftheretirementserver.
Sowhathappensisyouruserneedstowalkbackinbecausetheyneedtobeabletohavetheirsessionsstoredontheretirementserverbecausethesession I d fromtheclientisnotfoundintheretirementserver.
I knowthisis a littlebitconfusingtowrapyourheadarounditfirst, butessentiallywe'restoringtheuserinformationontheclientwhileintheoldcookiesessionversionwestoredontheserver.