Skip to content

A Git fork of hismetic. Will perhaps be synchronized with the upstream repository every now and then.

License

Notifications You must be signed in to change notification settings

dertuxmalwieder/cl-hismetic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Note: This library is developed as a part of 42links. This Git repository is not the canonical upstream repository, which, including its bug tracker, remains there. I will, however, maintain this copy for your convenience.

hismetic

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?

About

A Git fork of hismetic. Will perhaps be synchronized with the upstream repository every now and then.

Topics

Resources

License

Stars

Watchers

Forks