From 2ca6fd5f1e5030daa73daac8a0a24bf8d0146962 Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Sun, 6 Feb 2011 11:30:40 -0600 Subject: [PATCH] Add Secrets API search examples. * auth-source.el (auth-source-secrets-search): Add examples. --- lisp/ChangeLog | 4 ++++ lisp/auth-source.el | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d7cc2745d..8261c3989 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2011-02-06 Teodor Zlatanov + + * auth-source.el (auth-source-secrets-search): Add examples. + 2011-02-06 Julien Danjou * message.el (message-setup-1): Handle message-generate-headers-first diff --git a/lisp/auth-source.el b/lisp/auth-source.el index f7b559110..0283233ca 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -862,6 +862,7 @@ See `auth-source-search' for details on SPEC." ;;; (let ((auth-sources '(default))) (auth-source-search :max 1 :delete t)) ;;; (let ((auth-sources '(default))) (auth-source-search :max 1)) ;;; (let ((auth-sources '("secrets:login"))) (auth-source-search :max 1)) +;;; (let ((auth-sources '("secrets:login"))) (auth-source-search :max 1 :signon_realm "https://git.gnus.org/Git")) (defun* auth-source-secrets-search (&rest spec @@ -879,7 +880,25 @@ matching, do a wider search and narrow it down yourself. You'll get back all the properties of the token as a plist. -TODO: Example." +Here's an example that looks for the first item in the 'login' +Secrets collection: + + \(let ((auth-sources '(\"secrets:login\"))) + (auth-source-search :max 1) + +Here's another that looks for the first item in the 'login' +Secrets collection whose label contains 'gnus': + + \(let ((auth-sources '(\"secrets:login\"))) + (auth-source-search :max 1 :label \"gnus\") + +And this one looks for the first item in the 'login' Secrets +collection that's a Google Chrome entry for the git.gnus.org site +login: + + \(let ((auth-sources '(\"secrets:login\"))) + (auth-source-search :max 1 :signon_realm \"https://git.gnus.org/Git\")) +" ;; TODO (assert (not create) nil @@ -1035,6 +1054,7 @@ MODE can be \"login\" or \"password\"." (when (member "login" mode) (push (funcall (plist-get :user choice)) found))) (setq found (if listy found (car-safe found))))) + found)) (provide 'auth-source) -- 2.34.1