Fix furnace basic auth; add test

db4
Jon Harper 2013-11-03 21:22:15 +01:00
parent 7d8f05012a
commit a3fcaf4a11
2 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,13 @@
! Copyright (C) 2013 Jon Harper.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors tools.test furnace.auth.basic http.server
http.server.responses kernel http namespaces ;
IN: furnace.auth.basic.tests
CONSTANT: GET-AUTH "Basic Zm9vOmJhcg=="
{ "foo" "bar" } [ GET-AUTH parse-basic-auth ] unit-test
{ t } [ [ <request> "GET" >>method init-request
"path" <304> <trivial-responder> "name" <basic-auth-realm>
call-responder* >boolean
] with-scope ] unit-test

View File

@ -27,3 +27,5 @@ M: basic-auth-realm logged-in-username ( realm -- uid )
drop
request get "authorization" header parse-basic-auth
dup [ over check-login swap and ] [ 2drop f ] if ;
M: basic-auth-realm init-realm drop ;