aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2025-09-07 12:18:42 +0200
committerMichael Albinus2025-09-07 12:18:42 +0200
commit96d90403417fbe417d5eb4c8a9d171a559d46c2b (patch)
treeff0f1609c01afe8f39c5f729765c525088a59d38
parent5e57829ffd8335e815545ae70a373c37f7bd1f59 (diff)
downloademacs-96d90403417fbe417d5eb4c8a9d171a559d46c2b.tar.gz
emacs-96d90403417fbe417d5eb4c8a9d171a559d46c2b.zip
Fix auth-source.el doc
* doc/misc/auth.texi (Help for users): Change variables to user options where appropriate. Use setopt for them. Add Tramp link. Fix example. (Bug#9113) * lisp/auth-source.el (auth-sources): Add :link.
-rw-r--r--doc/misc/auth.texi67
-rw-r--r--lisp/auth-source.el3
2 files changed, 36 insertions, 34 deletions
diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi
index fe920997f1d..d1ebd971c3a 100644
--- a/doc/misc/auth.texi
+++ b/doc/misc/auth.texi
@@ -163,7 +163,7 @@ problems, your first step is always to see what's being checked. The
163second step, of course, is to write a blog entry about it and wait for 163second step, of course, is to write a blog entry about it and wait for
164the answer in the comments. 164the answer in the comments.
165 165
166You can customize the variable @code{auth-sources}. The following may 166You can customize the user option @code{auth-sources}. The following may
167be needed if you are using an older version of Emacs or if the 167be needed if you are using an older version of Emacs or if the
168auth-source library is not loaded for some other reason. 168auth-source library is not loaded for some other reason.
169 169
@@ -172,29 +172,29 @@ auth-source library is not loaded for some other reason.
172(customize-variable 'auth-sources) ;; optional, do it once 172(customize-variable 'auth-sources) ;; optional, do it once
173@end lisp 173@end lisp
174 174
175@defvar auth-sources 175@defopt auth-sources
176 176
177The @code{auth-sources} variable tells the auth-source library where 177The @code{auth-sources} user option tells the auth-source library where
178your netrc files, Secret Service API collection items, or your 178your netrc files, Secret Service API collection items, or your
179password store live for a particular host and protocol. While you can 179password store live for a particular host and protocol. While you can
180get fancy, the default and simplest configuration is: 180get fancy, the default and simplest configuration is:
181 181
182@lisp 182@lisp
183;;; old default: required :host and :port, not needed anymore 183;;; old default: required :host and :port, not needed anymore
184(setq auth-sources '((:source "~/.authinfo.gpg" :host t :port t))) 184(setopt auth-sources '((:source "~/.authinfo.gpg" :host t :port t)))
185;;; mostly equivalent (see below about fallbacks) but shorter: 185;;; mostly equivalent (see below about fallbacks) but shorter:
186(setq auth-sources '((:source "~/.authinfo.gpg"))) 186(setopt auth-sources '((:source "~/.authinfo.gpg")))
187;;; even shorter and the @emph{default}: 187;;; even shorter:
188(setq auth-sources '("~/.authinfo.gpg" "~/.authinfo" "~/.netrc")) 188(setopt auth-sources '("~/.authinfo.gpg"))
189;;; use the Secrets API @var{Login} collection 189;;; use the Secrets API @var{Login} collection
190;;; (@pxref{Secret Service API}) 190;;; (@pxref{Secret Service API})
191(setq auth-sources '("secrets:Login")) 191(setopt auth-sources '("secrets:Login"))
192;;; use pass (@file{~/.password-store}) 192;;; use pass (@file{~/.password-store})
193;;; (@pxref{The Unix password store}) 193;;; (@pxref{The Unix password store})
194(auth-source-pass-enable) 194(auth-source-pass-enable)
195;;; JSON data in format [@{ "machine": "SERVER", 195;;; JSON data in format [@{ "machine": "SERVER",
196;;; "login": "USER", "password": "PASSWORD" @}...] 196;;; "login": "USER", "password": "PASSWORD" @}...]
197(setq auth-sources '("~/.authinfo.json.gpg")) 197(setopt auth-sources '("~/.authinfo.json.gpg"))
198@end lisp 198@end lisp
199 199
200By adding multiple entries to @code{auth-sources} with a particular 200By adding multiple entries to @code{auth-sources} with a particular
@@ -206,12 +206,12 @@ have unusual setups and the remaining 10% are @emph{really} unusual).
206Here's a mixed example using two sources: 206Here's a mixed example using two sources:
207 207
208@lisp 208@lisp
209(setq auth-sources '((:source (:secrets default) 209(setopt auth-sources '((:source (:secrets default)
210 :host "myserver" :user "joe") 210 :host "myserver" :user "joe")
211 "~/.authinfo.gpg")) 211 "~/.authinfo.gpg"))
212@end lisp 212@end lisp
213 213
214@end defvar 214@end defopt
215 215
216If you don't customize @code{auth-sources}, you'll have to live with 216If you don't customize @code{auth-sources}, you'll have to live with
217the defaults: the unencrypted netrc file @file{~/.authinfo} will be 217the defaults: the unencrypted netrc file @file{~/.authinfo} will be
@@ -265,6 +265,7 @@ Note that the port denotes the Tramp connection method. When you
265don't use a port entry, you match any Tramp method, as explained 265don't use a port entry, you match any Tramp method, as explained
266earlier. Since Tramp has about 88 connection methods, this may be 266earlier. Since Tramp has about 88 connection methods, this may be
267necessary if you have an unusual (see earlier comment on those) setup. 267necessary if you have an unusual (see earlier comment on those) setup.
268@xref{Password handling, Password handling,, tramp, Tramp}.
268 269
269The netrc format is directly translated into JSON, if you are into 270The netrc format is directly translated into JSON, if you are into
270that sort of thing. Just point to a JSON file with entries like this: 271that sort of thing. Just point to a JSON file with entries like this:
@@ -285,9 +286,9 @@ names:
285 286
286@example 287@example
287(setq gnus-secondary-select-methods '((nnimap "gmail" 288(setq gnus-secondary-select-methods '((nnimap "gmail"
288 (nnimap-address "imap.gmail.com")) 289 (nnimap-address "imap.gmail.com"))
289 (nnimap "gmail2" 290 (nnimap "gmail2"
290 (nnimap-address "imap.gmail.com")))) 291 (nnimap-address "imap.gmail.com"))))
291@end example 292@end example
292 293
293Your netrc entries will then be: 294Your netrc entries will then be:
@@ -460,10 +461,10 @@ example that sets @code{auth-sources} to search three collections and
460then fall back to @file{~/.authinfo.gpg}. 461then fall back to @file{~/.authinfo.gpg}.
461 462
462@example 463@example
463(setq auth-sources '(default 464(setopt auth-sources '(default
464 "secrets:session" 465 "secrets:session"
465 "secrets:Login" 466 "secrets:Login"
466 "~/.authinfo.gpg")) 467 "~/.authinfo.gpg"))
467@end example 468@end example
468 469
469Attribute values in the auth-source spec, which are not strings (like 470Attribute values in the auth-source spec, which are not strings (like
@@ -477,7 +478,7 @@ functions.
477manager} (or just @samp{pass}) stores your passwords in 478manager} (or just @samp{pass}) stores your passwords in
478@code{gpg}-protected files following the Unix philosophy. The store 479@code{gpg}-protected files following the Unix philosophy. The store
479location (any directory) must be specified in the 480location (any directory) must be specified in the
480@code{auth-source-pass-filename} variable which defaults to 481@code{auth-source-pass-filename} user option which defaults to
481@file{~/.password-store}. 482@file{~/.password-store}.
482 483
483Emacs integration of @samp{pass} follows the approach suggested by the 484Emacs integration of @samp{pass} follows the approach suggested by the
@@ -503,7 +504,7 @@ host with an at-sign (@code{@@}).
503@item gnu.org:22.gpg 504@item gnu.org:22.gpg
504The port (aka. service) to match can only be expressed after the host 505The port (aka. service) to match can only be expressed after the host
505and separated with a colon (@code{:}). The separator can be changed 506and separated with a colon (@code{:}). The separator can be changed
506through the @code{auth-source-pass-port-separator} variable. 507through the @code{auth-source-pass-port-separator} user option.
507 508
508@item gnu.org:22/rms.gpg 509@item gnu.org:22/rms.gpg
509 510
@@ -544,17 +545,17 @@ library wrapping @samp{pass};
544@uref{https://github.com/jabranham/helm-pass,,helm-pass}: helm interface for pass. 545@uref{https://github.com/jabranham/helm-pass,,helm-pass}: helm interface for pass.
545@end itemize 546@end itemize
546 547
547@defvar auth-source-pass-filename 548@defopt auth-source-pass-filename
548Set this variable to a string locating the password store on the disk. 549Set this user option to a string locating the password store on the disk.
549Defaults to @file{~/.password-store}. 550Defaults to @file{~/.password-store}.
550@end defvar 551@end defopt
551 552
552@defvar auth-source-pass-port-separator 553@defopt auth-source-pass-port-separator
553Set this variable to a string that should separate an host name from a 554Set this user option to a string that should separate an host name from a
554port in an entry. Defaults to @samp{:}. 555port in an entry. Defaults to @samp{:}.
555@end defvar 556@end defopt
556 557
557@defvar auth-source-pass-extra-query-keywords 558@defopt auth-source-pass-extra-query-keywords
558This expands the selection of available keywords to include 559This expands the selection of available keywords to include
559@code{:max} and @code{:require} and tells more of them to accept a 560@code{:max} and @code{:require} and tells more of them to accept a
560list of query parameters as an argument. When searching, it also 561list of query parameters as an argument. When searching, it also
@@ -569,18 +570,18 @@ matching against subdomain labels, keep this option set to @code{nil}
569of searches relative to other auth-source backends or encounter code 570of searches relative to other auth-source backends or encounter code
570expecting to query multiple backends uniformly, try flipping it to 571expecting to query multiple backends uniformly, try flipping it to
571@code{t}. 572@code{t}.
572@end defvar 573@end defopt
573 574
574@node Help for developers 575@node Help for developers
575@chapter Help for developers 576@chapter Help for developers
576 577
577The auth-source library lets you control logging output easily. 578The auth-source library lets you control logging output easily.
578 579
579@defvar auth-source-debug 580@defopt auth-source-debug
580Set this variable to @code{'trivia} to see lots of output in 581Set this user option to @code{'trivia} to see lots of output in
581@file{*Messages*}, or set it to a function that behaves like 582@file{*Messages*}, or set it to a function that behaves like
582@code{message} to do your own logging. 583@code{message} to do your own logging.
583@end defvar 584@end defopt
584 585
585The auth-source library only has a few functions for external use. 586The auth-source library only has a few functions for external use.
586 587
@@ -671,7 +672,7 @@ record.
671@node GnuPG and EasyPG Assistant Configuration 672@node GnuPG and EasyPG Assistant Configuration
672@appendix GnuPG and EasyPG Assistant Configuration 673@appendix GnuPG and EasyPG Assistant Configuration
673 674
674If the @code{auth-sources} variable contains @file{~/.authinfo.gpg} 675If the @code{auth-sources} user option contains @file{~/.authinfo.gpg}
675before @file{~/.authinfo}, the auth-source library will try to 676before @file{~/.authinfo}, the auth-source library will try to
676read the GnuPG encrypted @file{.gpg} file first, before 677read the GnuPG encrypted @file{.gpg} file first, before
677the unencrypted file. 678the unencrypted file.
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index c72cb24cf74..ff568e7a007 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -301,7 +301,8 @@ the choices can get pretty complex."
301 (const :tag "Any" t) 301 (const :tag "Any" t)
302 (string 302 (string
303 :tag "Name")))))) 303 :tag "Name"))))))
304 (sexp :tag "A data structure (external provider)")))) 304 (sexp :tag "A data structure (external provider)")))
305 :link '(custom-manual "(auth) Help for users"))
305 306
306(defcustom auth-source-gpg-encrypt-to t 307(defcustom auth-source-gpg-encrypt-to t
307 "List of recipient keys that `authinfo.gpg' encrypted to. 308 "List of recipient keys that `authinfo.gpg' encrypted to.