42links

All Files in hismetic/
Login

All Files in hismetic/

Files in directory /hismetic in any check-in


Huh?

This is a fork of hermetic, a deprecated authentication framework for Clack-based Common Lisp web applications. The demo remains (mostly) compatible, except that cl-pass has been replaced by bcrypt hashing.

bcrypt?

Yes. hismetic uses bcrypt and I don't care about other algorithms. Do not suggest them.

Usage

Load hismetic.lisp from inside your project, then run (hismetic:setup), providing functions that access users, passwords and roles:

(defun user-exists-p (user)
  ;; Return t or nil here, depending on whether the
  ;; user name <user> exists.
)

(defun get-user-password (user)
  ;; Return the user password. Hashing recommended.
)

(defun get-user-roles (user)
  ;; Return a list of roles for the user here.
  ;; ex.: (list :users :staff)
)

;; Set up a session:
(hismetic:setup
 :user-p #'(lambda (user) (user-exists-p user))
 :user-pass #'(lambda (user) (get-user-password user))
 :user-roles #'(lambda (user) (get-user-roles user))
 :session *session*
 :denied #'(lambda (&optional params) "Access denied."))

Make sure your Clack application uses sessions:

(clack:clackup (builder :session *app*))

Now, (hismetic:login) adds a user handle to your session, (hismetic:logout) removes it. hismetic.lisp contains a couple of helper methods and macros for your convenience as well, please consider the comments in the code and/or the example application below on how to use them.

Demo?

The reference demo application for hismetic is 42links.

"His"metic?

Well, it's not her metic anymore, is it?