39 lines
953 B
Common Lisp
39 lines
953 B
Common Lisp
;;;; cl-scopes/lib/auth - authentication services
|
|
|
|
(defpackage :scopes-auth
|
|
(:use :common-lisp)
|
|
(:local-nicknames (:config :scopes/config)
|
|
(:core :scopes/core)
|
|
(:util :scopes/util))
|
|
(:export #:config #:setup
|
|
#:login))
|
|
|
|
(in-package :scopes-auth)
|
|
|
|
(defvar *authenticator* nil)
|
|
|
|
(defclass config (config:base)
|
|
((admin-credentials :reader admin-credentials :initarg :admin-credentials)))
|
|
|
|
(defun setup (cfg)
|
|
(let ((ctx (core:default-setup cfg))
|
|
(*authenticator* (make-instance 'simple-authenticator)))
|
|
ctx))
|
|
|
|
;;;; simple / basic auth service implementation
|
|
|
|
(defclass simple-authenticator () ())
|
|
|
|
(defclass simple-credentials () ())
|
|
|
|
(defclass internal-principal () ())
|
|
|
|
(defun authenticate (cred)
|
|
(make-instance 'internal-principal))
|
|
|
|
;;;; login entry point
|
|
|
|
(defun login (cred)
|
|
(let ((srv (core:find-service :auth)))
|
|
(util:lgi cred (admin-credentials (core:config srv)))))
|
|
|