aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/misc/ChangeLog5
-rw-r--r--doc/misc/auth.texi81
2 files changed, 67 insertions, 19 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 1204e757771..1f419b34d48 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,8 @@
12010-03-27 Teodor Zlatanov <tzz@lifelogs.com>
2
3 * auth.texi (Secret Service API): Add TODO node.
4 (Help for users): Explain the new source options for `auth-sources'.
5
12010-03-24 Michael Albinus <michael.albinus@gmx.de> 62010-03-24 Michael Albinus <michael.albinus@gmx.de>
2 7
3 * trampver.texi: Update release number. 8 * trampver.texi: Update release number.
diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi
index dd588be2a39..a2c319c583f 100644
--- a/doc/misc/auth.texi
+++ b/doc/misc/auth.texi
@@ -57,6 +57,7 @@ It is a way for multiple applications to share a single configuration
57@menu 57@menu
58* Overview:: Overview of the auth-source library. 58* Overview:: Overview of the auth-source library.
59* Help for users:: 59* Help for users::
60* Secret Service API::
60* Help for developers:: 61* Help for developers::
61* Index:: 62* Index::
62* Function Index:: 63* Function Index::
@@ -68,15 +69,15 @@ It is a way for multiple applications to share a single configuration
68@chapter Overview 69@chapter Overview
69 70
70The auth-source library is simply a way for Emacs and Gnus, among 71The auth-source library is simply a way for Emacs and Gnus, among
71others, to find the answer to the old burning question ``I have a 72others, to answer the old burning question ``I have a server name and
72server name and a port, what are my user name and password?'' 73a port, what are my user name and password?''
73 74
74The auth-source library actually supports more than just the user name 75The auth-source library actually supports more than just the user name
75(known as the login) or the password, but only those two are in use 76(known as the login) or the password, but only those two are in use
76today in Emacs or Gnus. Similarly, the auth-source library can in 77today in Emacs or Gnus. Similarly, the auth-source library supports
77theory support multiple storage formats, but currently it only 78multiple storage formats, currently either the classic ``netrc''
78understands the classic ``netrc'' format, examples of which you can 79format, examples of which you can see later in this document, or the
79see later in this document. 80Secret Service API.
80 81
81@node Help for users 82@node Help for users
82@chapter Help for users 83@chapter Help for users
@@ -120,17 +121,21 @@ auth-source library is not loaded for some other reason.
120@defvar auth-sources 121@defvar auth-sources
121 122
122The @code{auth-sources} variable tells the auth-source library where 123The @code{auth-sources} variable tells the auth-source library where
123your netrc files live for a particular host and protocol. While you 124your netrc files or Secret Service API collection items live for a
124can get fancy, the default and simplest configuration is: 125particular host and protocol. While you can get fancy, the default
126and simplest configuration is:
125 127
126@lisp 128@lisp
129;;; old default: required :host and :protocol, not needed anymore
127(setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))) 130(setq auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t)))
131;;; mostly equivalent (see below about fallbacks) but shorter:
132(setq auth-sources '((:source "~/.authinfo.gpg")))
128@end lisp 133@end lisp
129 134
130This says ``for any host and any protocol, use just that one file.'' 135This says ``for any host and any protocol, use just that one file.''
131Sweet simplicity. In fact, this is already the default, so unless you 136Sweet simplicity. In fact, the latter is already the default, so
132want to move your netrc file, it will just work if you have that 137unless you want to move your netrc file, it will just work if you have
133file. You may not, though, so make sure it exists. 138that file. Make sure it exists.
134 139
135By adding multiple entries to @code{auth-sources} with a particular 140By adding multiple entries to @code{auth-sources} with a particular
136host or protocol, you can have specific netrc files for that host or 141host or protocol, you can have specific netrc files for that host or
@@ -138,6 +143,35 @@ protocol. Usually this is unnecessary but may make sense if you have
138shared netrc files or some other unusual setup (90% of Emacs users 143shared netrc files or some other unusual setup (90% of Emacs users
139have unusual setups and the remaining 10% are @emph{really} unusual). 144have unusual setups and the remaining 10% are @emph{really} unusual).
140 145
146Here's an example that uses the Secret Service API for all lookups,
147using the default collection:
148
149@lisp
150(setq auth-sources '((:source (:secrets default))))
151@end lisp
152
153And here's a mixed example, using two sources:
154
155@lisp
156(setq auth-sources '((:source (:secrets default) :host "myserver" :user "joe")
157 (:source "~/.authinfo.gpg")))
158@end lisp
159
160The best match is determined by order (starts from the bottom) only
161for the first pass, where things are checked exactly. In the example
162above, the first pass would find a single match for host
163@code{myserver}. The netrc choice would fail because it matches any
164host and protocol implicitly (as a @emph{fallback}). A specified
165value of @code{:host t} in @code{auth-sources} is considered a match
166on the first pass, unlike a missing @code{:host}.
167
168Now if you look for host @code{missing}, it won't match either source
169explicitly. The second pass (the @emph{fallback} pass) will look at
170all the implicit matches and collect them. They will be scored and
171returned sorted by score. The score is based on the number of
172explicit parameters that matched. See the @code{auth-pick} function
173for details.
174
141@end defvar 175@end defvar
142 176
143If you don't customize @code{auth-sources}, you'll have to live with 177If you don't customize @code{auth-sources}, you'll have to live with
@@ -190,25 +224,32 @@ don't use a port entry, you match any Tramp method, as explained
190earlier. Since Tramp has about 88 connection methods, this may be 224earlier. Since Tramp has about 88 connection methods, this may be
191necessary if you have an unusual (see earlier comment on those) setup. 225necessary if you have an unusual (see earlier comment on those) setup.
192 226
227@node Secret Service API
228@chapter Secret Service API
229
230TODO: how does it work generally, how does secrets.el work, some examples.
231
193@node Help for developers 232@node Help for developers
194@chapter Help for developers 233@chapter Help for developers
195 234
196The auth-source library only has one function for external use. 235The auth-source library only has one function for external use.
197 236
198@defun auth-source-user-or-password mode host port 237@defun auth-source-user-or-password mode host port &optional username
199 238
200Retrieve appropriate authentication tokens, determined by @var{mode}, 239Retrieve appropriate authentication tokens, determined by @var{mode},
201for host @var{host} and @var{port}. If @code{auth-source-debug} is t, 240for host @var{host} and @var{port}. If @var{username} is provided it
202debugging messages will be printed. Set @code{auth-source-debug} to a 241will also be checked. If @code{auth-source-debug} is t, debugging
203function to use that function for logging. The parameters passed will 242messages will be printed. Set @code{auth-source-debug} to a function
204be the same that the @code{message} function takes, that is, a string 243to use that function for logging. The parameters passed will be the
244same that the @code{message} function takes, that is, a string
205formatting spec and optional parameters. 245formatting spec and optional parameters.
206 246
207If @var{mode} is a list of strings, the function will return a list of 247If @var{mode} is a list of strings, the function will return a list of
208strings or @code{nil} objects (thus you can avoid parsing the netrc 248strings or @code{nil} objects (thus you can avoid parsing the netrc
209file more than once). If it's a string, the function will return a 249file or checking the Secret Service API more than once). If it's a
210string or a @code{nil} object. Currently only the modes ``login'' and 250string, the function will return a string or a @code{nil} object.
211``password'' are recognized but more may be added in the future. 251Currently only the modes ``login'' and ``password'' are recognized but
252more may be added in the future.
212 253
213@var{host} is a string containing the host name. 254@var{host} is a string containing the host name.
214 255
@@ -216,6 +257,8 @@ string or a @code{nil} object. Currently only the modes ``login'' and
216a port number. It must be a string, corresponding to the port in the 257a port number. It must be a string, corresponding to the port in the
217users' netrc files. 258users' netrc files.
218 259
260@var{username} contains the user name (e.g. ``joe'') as a string.
261
219@example 262@example
220;; IMAP example 263;; IMAP example
221(setq auth (auth-source-user-or-password 264(setq auth (auth-source-user-or-password