The mito-auth Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The mito-auth Reference Manual

This is the mito-auth Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 05:23:49 2022 GMT+0.

Table of Contents


1 Introduction

mito-auth

Mito-auth provides a Mito mixin class for user authorization.

Usage

(use-package :mito-auth)

;; Inherit mito-auth:has-secure-password.
;; It adds password_hash and password_salt.
(defclass user (has-secure-password)
  ((name :col-type (:varchar 60)
         :initarg :name
         :accessor user-name)
   (email :col-type (:varchar 255)
          :initarg :email
          :accessor user-email))
  (:metaclass mito:dao-table-class))

;; Connect to the DB
(mito:connect-toplevel :sqlite3 :database-name #P"/tmp/mito-auth.db")

;; Enable logging
(setf mito:*mito-logger-stream* t)

;; Ensure the table "user" exists
(mito:ensure-table-exists 'user)
;-> ;; CREATE TABLE IF NOT EXISTS "user" (
;       "id" INTEGER PRIMARY KEY AUTOINCREMENT,
;       "name" VARCHAR(60) NOT NULL,
;       "email" VARCHAR(255) NOT NULL,
;       "password_hash" CHAR(64) NOT NULL,
;       "password_salt" BYTEA NOT NULL,
;       "created_at" TIMESTAMP,
;       "updated_at" TIMESTAMP
;   ) () [0 rows] | MITO.DAO:ENSURE-TABLE-EXISTS

(mito:create-dao 'user
                 :name "Eitaro Fukamachi"
                 :email "e.arrows@gmail.com"
                 :password "c0mmon-l1sp")
;-> ;; INSERT INTO "user" ("name", "email", "password_hash", "password_salt", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) ("Eitaro Fukamachi", "e.arrows@gmail.com", "63ab35de18dffd24e51a98d5f9c4cd82e665053a73efbe7e006dc37e922d7949", "Lº€ÅLm&[FÂÍüîn24‹¾", "2016-02-19 17:47:10", "2016-02-19 17:47:10") [0 rows] | MITO.DAO:INSERT-DAO
;=> #<USER {100461A363}>

(defvar *user* (mito:find-dao 'user :email "e.arrows@gmail.com"))

(auth *user* "c0mmon-l1sp")
;=> T

(auth *user* "wrong-password")
;=> NIL

Installation

(ql:quickload :mito-auth)

See Also

Author

Copyright

Copyright (c) 2016 Eitaro Fukamachi (e.arrows@gmail.com)

License

Licensed under the LLGPL


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 mito-auth

User authorization for Mito classes

Author

Eitaro Fukamachi

License

LLGPL

Version

0.1

Dependencies
  • mito (system).
  • ironclad (system).
  • babel (system).
Source

mito-auth.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 mito-auth/src

Source

mito-auth.asd.

Parent Component

mito-auth (system).

Child Component

mito-auth.lisp (file).


4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

4.1.1 mito-auth/mito-auth.asd

Source

mito-auth.asd.

Parent Component

mito-auth (system).

ASDF Systems

mito-auth.


4.1.2 mito-auth/src/mito-auth.lisp

Source

mito-auth.asd.

Parent Component

src (module).

Packages

mito-auth.

Public Interface
Internals

make-password-hash (function).


5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 mito-auth

Source

mito-auth.lisp.

Nickname

mito.auth

Use List

common-lisp.

Public Interface
Internals

make-password-hash (function).


6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Public Interface


6.1.1 Ordinary functions

Function: auth (object password)
Package

mito-auth.

Source

mito-auth.lisp.


6.1.2 Generic functions

Generic Function: (setf password) (auth)
Package

mito-auth.

Source

mito-auth.lisp.

Methods
Method: (setf password) ((object has-secure-password))
Generic Reader: password-hash (object)
Package

mito-auth.

Methods
Reader Method: password-hash ((has-secure-password has-secure-password))

automatically generated reader method

Source

mito-auth.lisp.

Target Slot

password-hash.

Generic Reader: password-salt (object)
Package

mito-auth.

Methods
Reader Method: password-salt ((has-secure-password has-secure-password))

automatically generated reader method

Source

mito-auth.lisp.

Target Slot

password-salt.


6.1.3 Standalone methods

Method: initialize-instance :after ((object has-secure-password) &rest initargs &key password &allow-other-keys)
Source

mito-auth.lisp.


6.1.4 Classes

Class: has-secure-password
Package

mito-auth.

Source

mito-auth.lisp.

Direct methods
Direct slots
Slot: password-hash
Initargs

:password-hash

Readers

password-hash.

Writers

This slot is read-only.

Slot: password-salt
Initform

(let ((ironclad:*prng* (ironclad:make-prng :fortuna :seed :urandom))) (ironclad:make-random-salt 20))

Initargs

:password-salt

Readers

password-salt.

Writers

This slot is read-only.


6.2 Internals


Previous: , Up: Internals   [Contents][Index]

6.2.1 Ordinary functions

Function: make-password-hash (password salt)
Package

mito-auth.

Source

mito-auth.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   P   S  
Index Entry  Section

P
password-hash: Public classes
password-salt: Public classes

S
Slot, password-hash: Public classes
Slot, password-salt: Public classes

Jump to:   P   S