urbit/lib/basic-auth.hoon

35 lines
544 B
Plaintext
Raw Normal View History

2016-04-06 23:43:02 +03:00
:: Basic authentication
::
:::: /hoon/basic-auth/lib
::
2016-11-12 00:46:40 +03:00
=, ^eyre
2016-04-06 23:43:02 +03:00
|%
++ keys @t
--
::
::::
::
|_ {bal/(bale keys) $~}
++ auth
|%
++ header
^- cord
?~ key.bal
~_ leaf+"Run |init-auth-basic {<`path`dom.bal>}"
~|(%basic-auth-no-key !!)
(cat 3 'Basic ' key.bal)
--
::
++ add-auth-header
|= a/hiss ^- hiss
~& auth+(earn p.a)
%_(a q.q (~(add ja q.q.a) %authorization header:auth))
2016-04-06 23:43:02 +03:00
::
++ standard
|%
++ out-adding-header
|= a/hiss ^- sec-move
[%send (add-auth-header a)]
2016-04-06 23:43:02 +03:00
--
--