-
Notifications
You must be signed in to change notification settings - Fork 29
/
auth-dbus-external.lisp
27 lines (20 loc) · 1.08 KB
/
auth-dbus-external.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
;;;; +----------------------------------------------------------------+
;;;; | DBUS |
;;;; +----------------------------------------------------------------+
(defpackage #:dbus/auth-dbus-external
(:use #:cl #:dbus/utils #:dbus/protocols #:dbus/authentication-mechanisms)
(:import-from #:iolib.syscalls #:getuid)
(:export
#:dbus-external-authentication-mechanism))
(in-package #:dbus/auth-dbus-external)
;;;; DBUS external authentication mechanism
(defclass dbus-external-authentication-mechanism (standard-authentication-mechanism)
()
(:default-initargs :textual t)
(:documentation "Authenticate using external SASL method."))
(setf (find-authentication-mechanism-class "EXTERNAL")
'dbus-external-authentication-mechanism)
(defmethod feed-authentication-mechanism ((mechanism dbus-external-authentication-mechanism) challenge)
(if (eq challenge :initial-response)
(values :continue (encode-hex-string (write-to-string (getuid))))
(error "More than one response requested for EXTERNAL authentication.")))