mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Use auto-source-search' instead of auto-source-user-or-password'.
* mail/smtpmail.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (smtpmail-try-auth-methods): Use it. * net/imap-hash.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (imap-hash-open-connection): Use it. * net/tramp-imap.el: Autoload `auto-source-search' instead of `auto-source-user-or-password. (tramp-imap-passphrase-callback-function): Use it. * net/tramp.el (tramp-default-method): Also check if `auth-source-search' is bound. (tramp-read-passwd): Use `auth-source-search' instead of `auto-source-user-or-password'. * url-parse.el (url-bit-for-url, url-user-for-url) (url-password-for-url): Use `auto-source-search' instead of `auto-source-user-or-password'. * url-auth.el: Autoload `auto-source-search' instead of `auto-source-user-or-password'. (url-basic-auth, url-digest-auth, url-do-auth-source-search): Use it.
This commit is contained in:
parent
50fd938f33
commit
563790b6db
8 changed files with 101 additions and 33 deletions
|
|
@ -24,7 +24,7 @@
|
|||
(require 'url-vars)
|
||||
(require 'url-parse)
|
||||
(autoload 'url-warn "url")
|
||||
(autoload 'auth-source-user-or-password "auth-source")
|
||||
(autoload 'auth-source-search "auth-source")
|
||||
|
||||
(defsubst url-auth-user-prompt (url realm)
|
||||
"String to usefully prompt for a username."
|
||||
|
|
@ -81,11 +81,11 @@ instead of the filename inheritance method."
|
|||
(cond
|
||||
((and prompt (not byserv))
|
||||
(setq user (or
|
||||
(auth-source-user-or-password "login" server type)
|
||||
(url-do-auth-source-search server type :user)
|
||||
(read-string (url-auth-user-prompt url realm)
|
||||
(or user (user-real-login-name))))
|
||||
pass (or
|
||||
(auth-source-user-or-password "password" server type)
|
||||
(url-do-auth-source-search server type :secret)
|
||||
(read-passwd "Password: " nil (or pass ""))))
|
||||
(set url-basic-auth-storage
|
||||
(cons (list server
|
||||
|
|
@ -110,11 +110,11 @@ instead of the filename inheritance method."
|
|||
(if (or (and (not retval) prompt) overwrite)
|
||||
(progn
|
||||
(setq user (or
|
||||
(auth-source-user-or-password "login" server type)
|
||||
(url-do-auth-source-search server type :user)
|
||||
(read-string (url-auth-user-prompt url realm)
|
||||
(user-real-login-name)))
|
||||
pass (or
|
||||
(auth-source-user-or-password "password" server type)
|
||||
(url-do-auth-source-search server type :secret)
|
||||
(read-passwd "Password: "))
|
||||
retval (base64-encode-string (format "%s:%s" user pass))
|
||||
byserv (assoc server (symbol-value url-basic-auth-storage)))
|
||||
|
|
@ -173,11 +173,11 @@ instead of hostname:portnum."
|
|||
(cond
|
||||
((and prompt (not byserv))
|
||||
(setq user (or
|
||||
(auth-source-user-or-password "login" server type)
|
||||
(url-do-auth-source-search server type :user)
|
||||
(read-string (url-auth-user-prompt url realm)
|
||||
(user-real-login-name)))
|
||||
pass (or
|
||||
(auth-source-user-or-password "password" server type)
|
||||
(url-do-auth-source-search server type :secret)
|
||||
(read-passwd "Password: "))
|
||||
url-digest-auth-storage
|
||||
(cons (list server
|
||||
|
|
@ -204,11 +204,11 @@ instead of hostname:portnum."
|
|||
(if overwrite
|
||||
(if (and (not retval) prompt)
|
||||
(setq user (or
|
||||
(auth-source-user-or-password "login" server type)
|
||||
(url-do-auth-source-search server type :user)
|
||||
(read-string (url-auth-user-prompt url realm)
|
||||
(user-real-login-name)))
|
||||
pass (or
|
||||
(auth-source-user-or-password "password" server type)
|
||||
(url-do-auth-source-search server type :secret)
|
||||
(read-passwd "Password: "))
|
||||
retval (setq retval
|
||||
(cons user
|
||||
|
|
@ -244,6 +244,13 @@ instead of hostname:portnum."
|
|||
"A list of the registered authorization schemes and various and sundry
|
||||
information associated with them.")
|
||||
|
||||
(defun url-do-auth-source-search (server type parameter)
|
||||
(let* ((auth-info (auth-source-search :max 1 :host server :port type))
|
||||
(auth-info (nth 0 auth-info))
|
||||
(token (plist-get auth-info parameter))
|
||||
(token (if (functionp token) (funcall token) token)))
|
||||
token))
|
||||
|
||||
;;;###autoload
|
||||
(defun url-get-authentication (url realm type prompt &optional args)
|
||||
"Return an authorization string suitable for use in the WWW-Authenticate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue