]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/furnace/auth/basic/basic.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / furnace / auth / basic / basic.factor
index 802e489e74b5546a0d84a9db59c8b0252cec1c0a..af5f34e3e3e5a961a9a1412d41a8b49fb9c93567 100644 (file)
@@ -1,31 +1,31 @@
-! Copyright (c) 2007 Chris Double.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: accessors kernel splitting base64 namespaces make strings\r
-http http.server.responses furnace.auth ;\r
-IN: furnace.auth.basic\r
-\r
-TUPLE: basic-auth-realm < realm ;\r
-\r
-: <basic-auth-realm> ( responder name -- realm )\r
-    basic-auth-realm new-realm ;\r
-\r
-: parse-basic-auth ( header -- username/f password/f )\r
-    dup [\r
-        " " split1 swap "Basic" = [\r
-            base64> >string ":" split1\r
-        ] [ drop f f ] if\r
-    ] [ drop f f ] if ;\r
-\r
-: <401> ( realm -- response )\r
-    401 "Invalid username or password" <trivial-response>\r
-    [ "Basic realm=\"" % swap % "\"" % ] "" make "WWW-Authenticate" set-header ;\r
-\r
-M: basic-auth-realm login-required* ( description capabilities realm -- response )\r
-    2nip name>> <401> ;\r
-\r
-M: basic-auth-realm logged-in-username ( realm -- uid )\r
-    drop\r
-    request get "authorization" header parse-basic-auth\r
-    dup [ over check-login swap and ] [ 2drop f ] if ;\r
-\r
-M: basic-auth-realm init-realm drop ;\r
+! Copyright (c) 2007 Chris Double.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors kernel splitting base64 namespaces make strings
+http http.server.responses furnace.auth ;
+IN: furnace.auth.basic
+
+TUPLE: basic-auth-realm < realm ;
+
+: <basic-auth-realm> ( responder name -- realm )
+    basic-auth-realm new-realm ;
+
+: parse-basic-auth ( header -- username/f password/f )
+    dup [
+        " " split1 swap "Basic" = [
+            base64> >string ":" split1
+        ] [ drop f f ] if
+    ] [ drop f f ] if ;
+
+: <401> ( realm -- response )
+    401 "Invalid username or password" <trivial-response>
+    [ "Basic realm=\"" % swap % "\"" % ] "" make "WWW-Authenticate" set-header ;
+
+M: basic-auth-realm login-required* ( description capabilities realm -- response )
+    2nip name>> <401> ;
+
+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 ;