auth/web: start with testing client login
This commit is contained in:
parent
b4fc8ad05d
commit
b264886c17
5 changed files with 19 additions and 9 deletions
|
@ -6,8 +6,7 @@
|
||||||
:version "0.0.1"
|
:version "0.0.1"
|
||||||
:homepage "https://www.cyberconcepts.org"
|
:homepage "https://www.cyberconcepts.org"
|
||||||
:description "Authentication services"
|
:description "Authentication services"
|
||||||
:depends-on (:scopes
|
:depends-on (:scopes)
|
||||||
:flexi-streams :ironclad :qbase64)
|
|
||||||
:components ((:file "auth")
|
:components ((:file "auth")
|
||||||
(:file "web" :depends-on ("auth")))
|
(:file "web" :depends-on ("auth")))
|
||||||
:long-description "scopes framework: authentication services."
|
:long-description "scopes framework: authentication services."
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
`((("hx") server:message-handler :html-responder cs-hx:response)
|
`((("hx") server:message-handler :html-responder cs-hx:response)
|
||||||
(() server:fileserver
|
(() server:fileserver
|
||||||
:doc-root ,(t:test-path "" "docs"))))
|
:doc-root ,(t:test-path "" "docs"))))
|
||||||
(config:add-action '(:auth :login) #'auth:login)
|
(config:add-action '(:auth :login) #'web:login)
|
||||||
|
|
||||||
(config:add :client :class 'client:config
|
(config:add :client :class 'client:config
|
||||||
:base-url "http://localhost:8899"
|
:base-url "http://localhost:8899"
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
(:core :scopes/core)
|
(:core :scopes/core)
|
||||||
(:cs-hx :scopes/frontend/cs-hx)
|
(:cs-hx :scopes/frontend/cs-hx)
|
||||||
(:logging :scopes/logging)
|
(:logging :scopes/logging)
|
||||||
|
(:message :scopes/core/message)
|
||||||
(:server :scopes/web/server)
|
(:server :scopes/web/server)
|
||||||
(:shape :scopes/shape)
|
(:shape :scopes/shape)
|
||||||
(:t :scopes/testing))
|
(:t :scopes/testing))
|
||||||
|
@ -28,7 +29,9 @@
|
||||||
(core:setup-services)
|
(core:setup-services)
|
||||||
(let ((server (core:find-service :server))
|
(let ((server (core:find-service :server))
|
||||||
(client (core:find-service :client)))
|
(client (core:find-service :client)))
|
||||||
(test-login)))
|
(sleep 0.1)
|
||||||
|
(test-login)
|
||||||
|
(test-client client)))
|
||||||
(core:shutdown)
|
(core:shutdown)
|
||||||
(t:show-result))))
|
(t:show-result))))
|
||||||
|
|
||||||
|
@ -38,5 +41,10 @@
|
||||||
(== (auth:login cred) nil)
|
(== (auth:login cred) nil)
|
||||||
(setf cred '(:name "admin" :password "sc0pes"))
|
(setf cred '(:name "admin" :password "sc0pes"))
|
||||||
(setf pr1 (auth:login cred))
|
(setf pr1 (auth:login cred))
|
||||||
(== (shape:head-value pr1 :name) :admin)
|
(== (shape:head-value pr1 :name) :admin)))
|
||||||
))
|
|
||||||
|
(deftest test-client (client)
|
||||||
|
(let ((msg (message:create
|
||||||
|
'(:auth :login)
|
||||||
|
:data '(:name "admin" :password "sc0pes"))))
|
||||||
|
(client:send-message client msg)))
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
(defpackage :scopes-auth/web
|
(defpackage :scopes-auth/web
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:auth :scopes-auth)
|
(:local-nicknames (:auth :scopes-auth)
|
||||||
(:config :scopes/config))
|
(:config :scopes/config)
|
||||||
|
(:core :scopes/core))
|
||||||
(:export #:login))
|
(:export #:login))
|
||||||
|
|
||||||
(in-package :scopes-auth/web)
|
(in-package :scopes-auth/web)
|
||||||
|
|
||||||
|
(defun login (ctx msg)
|
||||||
|
(core:echo ctx msg))
|
||||||
|
|
|
@ -72,7 +72,8 @@
|
||||||
"<div><div><label>info</label>: test data</div></div>")) ; cs-hx:response
|
"<div><div><label>info</label>: test data</div></div>")) ; cs-hx:response
|
||||||
;"<dl><dt>info</dt><dd>test data</dd></dl>"))) ; default response
|
;"<dl><dt>info</dt><dd>test data</dd></dl>"))) ; default response
|
||||||
(let ((msg (message:create '(:test :cookie)
|
(let ((msg (message:create '(:test :cookie)
|
||||||
:data '(:name "mycookie" :value "my_value"))))
|
:data '(:name "mycookie" :value "my_value"
|
||||||
|
:domain "localhost"))))
|
||||||
(client:send-message client msg)
|
(client:send-message client msg)
|
||||||
(util:lgi client::*cookie-jar*))
|
(util:lgi client::*cookie-jar*))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue