auth: config with admin credentials

This commit is contained in:
Helmut Merz 2024-08-13 12:04:58 +02:00
parent b062ec2962
commit 0cd12b377b
3 changed files with 20 additions and 9 deletions

View file

@ -2,12 +2,16 @@
(defpackage :scopes-auth
(:use :common-lisp)
(:local-nicknames (:dom :scopes/web/dom)
(:local-nicknames (:config :scopes/config)
(:util :scopes/util))
(:import-from :scopes/web/dom #:div #:label)
(:export #:login))
(:export #:config
#:login))
(in-package :scopes-auth)
(defclass config (config:base)
((admin-credentials :initarg :admin-credentials)))
(defun login (cred)
(util:lgi cred))

4
lib/auth/test/.test.env Normal file
View file

@ -0,0 +1,4 @@
# lib/auth/test/.test.env - environment file for overriding config settings
SCOPES_ADMIN_LOGIN=admin
SCOPES_ADMIN_PASSWORD=sc0pes

View file

@ -5,17 +5,21 @@
(in-package :scopes-auth/test)
(config:root :env-keys
'(:address :port
:db-name :db-user :db-password))
(config:root
:env-keys '(:address :port :db-name :db-user :db-password
:admin-login :admin-password)
:env-path (t:test-path ".test.env"))
(config:add :logger :class 'logging:config
:loglevel :info
:logfile (t:test-path "scopes-test.log" "log")
:console nil)
(config:add :server
:class 'server:config
(config:add :auth :class 'auth:config
:admin-credentials `(:login ,(config:from-env :admin-login "admin")
:password ,(config:from-env :admin-password "secret")))
(config:add :server :class 'server:config
:port "8899"
:routes
`((("hx") server:message-handler :html-responder cs-hx:response)
@ -23,7 +27,6 @@
:doc-root ,(t:test-path "" "docs"))))
(config:add-action '(:auth :login) #'auth:login)
(config:add :client
:class 'client:config
(config:add :client :class 'client:config
:base-url "http://localhost:8899"
:doc-path "/" :api-path "/hx/")