mirror of
https://github.com/urbit/shrub.git
synced 2024-12-02 08:55:07 +03:00
minimal basic-auth refactor
This commit is contained in:
parent
cff175cb8d
commit
a24c4da4b3
@ -1,8 +1,27 @@
|
||||
!:
|
||||
=+ keys=@t
|
||||
|= bal/(bale keys)
|
||||
?~ key.bal
|
||||
~|(%basic-auth-no-key ~_(leaf+"Run |init-auth-basic {<`path`dom.bal>}" !!))
|
||||
=+ aut=authorization+(cat 3 'Basic ' key.bal)
|
||||
~& aut=`{@tas @t}`aut
|
||||
|=(a/hiss [%send %_(a q.q (~(add ja q.q.a) -.aut +.aut))])
|
||||
:: Basic authentication
|
||||
::
|
||||
:::: /hoon/basic-auth/lib
|
||||
::
|
||||
|%
|
||||
++ keys @t
|
||||
--
|
||||
::
|
||||
::::
|
||||
::
|
||||
|_ bal/(bale keys)
|
||||
++ auth-header
|
||||
^- {term cord}
|
||||
?~ key.bal
|
||||
~_ leaf+"Run |init-auth-basic {<`path`dom.bal>}"
|
||||
~|(%basic-auth-no-key !!)
|
||||
[%authorization (cat 3 'Basic ' key.bal)]
|
||||
::
|
||||
++ standard
|
||||
|%
|
||||
++ out-adding-header
|
||||
|= a/hiss ^- sec-move
|
||||
=+ aut=auth-header
|
||||
~& aut=aut
|
||||
[%send %_(a q.q (~(add ja q.q.a) -.aut +.aut))]
|
||||
--
|
||||
--
|
||||
|
@ -5,5 +5,6 @@
|
||||
/+ basic-auth
|
||||
!:
|
||||
|_ {bal/(bale keys:basic-auth) $~}
|
||||
++ out (basic-auth bal)
|
||||
++ aut ~(standard basic-auth bal)
|
||||
++ out out-adding-header:aut
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user