diff options
| author | ckonstanski <ckonstanski@pippiandcarlos.com> | 2018-01-20 22:07:54 -0700 |
|---|---|---|
| committer | ckonstanski <ckonstanski@pippiandcarlos.com> | 2018-01-20 22:07:54 -0700 |
| commit | c2f77f4296c6b13eeb86067a772192b70577bca6 (patch) | |
| tree | 8437af60a559b7ed206fe4b256b4ea583292b9f1 /service/login-authenticate.lisp | |
initial commit
Diffstat (limited to 'service/login-authenticate.lisp')
| -rw-r--r-- | service/login-authenticate.lisp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/service/login-authenticate.lisp b/service/login-authenticate.lisp new file mode 100644 index 0000000..5b657a0 --- /dev/null +++ b/service/login-authenticate.lisp @@ -0,0 +1,24 @@ +;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- +(declaim (optimize (speed 0) (safety 3) (debug 3))) + +(in-package #:ldapadmin) + +;; ========================================================================== ;; + +(defclass login-authenticate (rest-service) + ((location-p :initarg :location-p + :initform nil + :accessor location-p)) + (:documentation "")) + +(defmethod initialize-instance :after ((login-authenticate login-authenticate) &key auth-result) + (if auth-result + (setf (message login-authenticate) "Successfully logged in.") + (setf (errormsg login-authenticate) "Login failed."))) + +(defun login-authenticate-json (dn password) + (let ((auth-result nil)) + (when (check-ldap-password (ldap *webapp*) dn password) + (setf (session-value :permissions) "admin") + (setf auth-result t)) + (objects-to-json `(,(make-instance 'login-authenticate :auth-result auth-result))))) |
