Skip to content

Instantly share code, notes, and snippets.

@PuercoPop
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PuercoPop/9792537 to your computer and use it in GitHub Desktop.
Save PuercoPop/9792537 to your computer and use it in GitHub Desktop.
(ql:quickload :optima)
(ql:quickload :split-sequence)
(defun process-auth-header (auth-header)
"Validate that is the correct 'scheme' (NOQ) and return the id and the
digest."
(match (split-sequence #\: auth-header)
((list first digest) (cons digest . first))))
;; Error
;;
;; The value FIRST is not of type LIST.
;; [Condition of type TYPE-ERROR]
;;
;; Expected
;;
;; (process-auth-header "NOQ toto:ly0u787twocI0k1SnvB2mp0dnaobK2tsdtiiNRzyYXE=")
;; => ly0u787twocI0k1SnvB2mp0dnaobK2tsdtiiNRzyYXE=
;; Silly rabbit an extra .
;; Finished function
(defun process-auth-header (auth-header)
"Validate that is the correct 'scheme' (NOQ) and return the id and the
digest."
(match (split-sequence #\: auth-header)
((list first digest)
(match (split-sequence #\Space first)
((list scheme user-id)
(progn
(assert (string= scheme "NOQ"))
(values user-id digest)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment