jael-scry session validity, password

This commit is contained in:
Anton Dyudin 2016-09-16 16:12:00 -07:00
parent a8016ca4de
commit 648d0944a0

View File

@ -68,7 +68,7 @@
++ mini-jael-scry ++ mini-jael-scry
$% {$pass him/ship pas/@t} :: ? $% {$pass him/ship pas/@t} :: ?
{$cook ses/hole} :: (unit ship) {$cook ses/hole} :: (unit ship)
{$oryx ses/hole tok/oryx} :: ? {$ixor ses/hole tok/ixor} :: ?
== ==
++ ixor @t :: oryx hash ++ ixor @t :: oryx hash
++ mend ?($get $head) :: amend after building ++ mend ?($get $head) :: amend after building
@ -141,8 +141,7 @@
== ==
:: ::
++ stem :: client view ++ stem :: client view
$: ses/hole :: associated session $: him/ship :: static identity
him/ship :: static identity
pol/(unit duct) :: long-poll pol/(unit duct) :: long-poll
sus/(set {dock $json wire path}) :: subscriptions sus/(set {dock $json wire path}) :: subscriptions
eve/{p/@u q/(map @u even)} :: queued events eve/{p/@u q/(map @u even)} :: queued events
@ -637,8 +636,8 @@
== ==
:: ::
++ kill-cookie ++ kill-cookie
|= ses/hole |= ses/hole :: XX actively kill tokens?
=/ ole (~(got by cok) ses) =/ ole (~(got by cok) ses)
=. +>.$ (reset-timer je+ses+/[ses] `die.ole ~) =. +>.$ (reset-timer je+ses+/[ses] `die.ole ~)
%_ +>.$ %_ +>.$
cok (~(del by cok) ses) cok (~(del by cok) ses)
@ -708,7 +707,7 @@
:- %u-ship :- %u-ship
(~(get by secondary.jel) ses.a) (~(get by secondary.jel) ses.a)
:: ::
$oryx $ixor
:- %bean :- %bean
=/ loc (~(got by primary.jel) (~(got by secondary.jel) ses.a)) =/ loc (~(got by primary.jel) (~(got by secondary.jel) ses.a))
=(ses.a ses:(~(got by tok.loc) tok.a)) =(ses.a ses:(~(got by tok.loc) tok.a))
@ -1235,9 +1234,12 @@
?~ oxe | ?~ oxe |
=/ ses (session-from-cookies cookie-prefix maf) =/ ses (session-from-cookies cookie-prefix maf)
?~ ses ~&(%oryx-no-cookie &) :: XX security ?~ ses ~&(%oryx-no-cookie &) :: XX security
=/ cyz (~(get by wix) (oryx-to-ixor u.oxe)) ?~ ~(get-user ya u.ses) ~&(%oryx-bad-cookie |)
?~ cyz ~&(bad-oryx+u.oxe &) :: XX security? =/ ire (oryx-to-ixor u.oxe)
?. =(u.ses ses.u.cyz) ?~ (~(get by wix) ire) ~&(bad-oryx+u.oxe &) :: XX security?
=+ (scry-jael %ixor u.ses ire)
?> ?=($bean -<)
?. ->
~&(oryx-ses-mismatch+[orx=u.oxe u.ses] &) :: XX security ~&(oryx-ses-mismatch+[orx=u.oxe u.ses] &) :: XX security
& &
:: ::
@ -1485,7 +1487,7 @@
:: ::
$view $view
~| lost-ixor+p.hem ~| lost-ixor+p.hem
[%| ((teba poll:(ire-ix p.hem)) u.q.hem)] [%| ((teba poll:(ire-ix p.hem)) u.q.hem ses:for-client)]
== ==
:: ::
++ process-auth ++ process-auth
@ -1535,7 +1537,7 @@
?. =(our him.ham) ?. =(our him.ham)
~|(stub-foreign+him.ham !!) ~|(stub-foreign+him.ham !!)
?. ?| =(get-user.yac `him.ham) ?. ?| =(get-user.yac `him.ham)
?~(paz.ham | =(u.paz.ham load-secret)) ?~(paz.ham | (check-password him.ham u.paz.ham))
== ==
~|(%auth-fail !!) ~|(%auth-fail !!)
=. yac (for-authed-client him.ham) =. yac (for-authed-client him.ham)
@ -1544,6 +1546,12 @@
(give-json 200 cug jon) :: XX wait for session save? (give-json 200 cug jon) :: XX wait for session save?
== ==
:: ::
++ check-password
|= pas/{ship @t} ^- ?
=+ (scry-jael %pass pas)
?> ?=($bean -<)
->
::
++ show-login-page ++ show-login-page
^- (each pest _done) ^- (each pest _done)
?. ?=($@($~ {$~ $html}) p.pok) ?. ?=($@($~ {$~ $html}) p.pok)
@ -1601,7 +1609,7 @@
^+ [*oryx ..ya] ^+ [*oryx ..ya]
=+ orx=`@t`(rsh 3 1 (scot %p (shaf %orx eny))) =+ orx=`@t`(rsh 3 1 (scot %p (shaf %orx eny)))
=+ ire=(oryx-to-ixor orx) =+ ire=(oryx-to-ixor orx)
[orx ~(init ix ire %*(. *stem ses ses, him anon, p.eve 1))] :: XX fix him on ack? [orx %.(ses ~(init ix ire %*(. *stem him anon, p.eve 1)))] :: XX fix him on ack?
:: ::
++ stat-json ++ stat-json
^+ [*json ..ya] ^+ [*json ..ya]
@ -1646,7 +1654,9 @@
:: ~& > hurl+[&2.b ire a] :: ~& > hurl+[&2.b ire a]
(pass-note:abet [%of ire (gsig a)] b) (pass-note:abet [%of ire (gsig a)] b)
:: ::
++ init (jael-note:abet of+/[ire] %save-token ses ire) ++ init
|= ses/hole ^+ ..ix
(jael-note:abet of+/[ire] %save-token ses ire)
:: ::
++ add-even ++ add-even
|= a/even ^+ eve |= a/even ^+ eve
@ -1749,7 +1759,7 @@
:: ::
++ pop-duct =^(ned med ~(get to med) abet(hen ned)) ++ pop-duct =^(ned med ~(get to med) abet(hen ned))
++ poll ++ poll
|= seq/@u ^+ ..ix |= {seq/@u ses/hole} ^+ ..ix
=< abet =< abet
=. ..ix (jael-note of+/[ire] %live-token ses ire) =. ..ix (jael-note of+/[ire] %live-token ses ire)
?: =(seq p.eve) ?: =(seq p.eve)