;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.web-server.test) (def class authentication-application (standard-application) ()) (def special-variable *authentication-application* (make-instance 'authentication-application :path "authentication")) (def entry-point (*authentication-application* :path +login-entry-point-path+) (call-with-entry-point-logic/login-with-identifier-and-password (named-lambda login-entry-point-response-factory (&key login-data (user-action? #f) (authentication-happened? #f) &allow-other-keys) (declare (ignore login-data user-action? authentication-happened?)) (make-raw-functional-response () (emit-http-response/simple-html-document (:title "Login" :status +http-ok+) (if *session*
>
>>

) (flet ((render-login-link (identifier password)
)) (render-login-link "test" "test123") (render-login-link "test" "wrong-password") (render-login-link "joe" nil))
))))) (def entry-point (*authentication-application* :path "logout/") (with-session-logic (:requires-valid-session #f) (when *session* (logout-current-session)) (make-redirect-response (make-uri-for-current-application +login-entry-point-path+)))) (def method authenticate ((application authentication-application) (session session-with-login-support) (login-data login-data/identifier-and-password)) (bind ((entry (assoc (identifier-of login-data) '(("test" "test123") ("joe" nil)) :test 'equal))) (if (and entry (equal (second entry) (password-of login-data))) (first entry) ;; authentication failed nil)))