From 142166df54eda65925921799a4bb3e7f6cdaba48 Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Tue, 6 Feb 2018 21:42:54 -0700 Subject: initial commit --- service/login-authenticate.lisp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 service/login-authenticate.lisp (limited to 'service/login-authenticate.lisp') diff --git a/service/login-authenticate.lisp b/service/login-authenticate.lisp new file mode 100644 index 0000000..7ef038f --- /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 #:music-dispensary) + +;; ========================================================================== ;; + +(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))))) -- cgit v1.3