Function: url-digest-find-new-key

url-digest-find-new-key is a byte-compiled function defined in url-auth.el.gz.

Signature

(url-digest-find-new-key URL REALM PROMPT)

Documentation

Find credentials and create a new authorization key for given URL and REALM.

Return value is the new key, or nil if credentials weren't found.
"New" in this context means a key that's not yet found in cache
variable url-digest-auth-storage. You may use url-digest-cache-key to put it there.

This function uses url-digest-find-creds to find the credentials. It first looks in auth-source. If not found, and PROMPT is non-nil, user is asked for credentials interactively via minibuffer.

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-auth.el.gz
(defun url-digest-find-new-key (url realm prompt)
  "Find credentials and create a new authorization key for given URL and REALM.

Return value is the new key, or nil if credentials weren't found.
\"New\" in this context means a key that's not yet found in cache
variable `url-digest-auth-storage'.  You may use `url-digest-cache-key'
to put it there.

This function uses `url-digest-find-creds' to find the
credentials.  It first looks in auth-source.  If not found, and
PROMPT is non-nil, user is asked for credentials interactively
via minibuffer."
  (let (creds)
    (unwind-protect
        (if (setq creds (url-digest-find-creds url prompt realm))
            (cons (url-digest-auth-directory-id url realm)
                  (cons (plist-get creds :user)
                        (url-digest-auth-create-key
                         (plist-get creds :user)
                         (plist-get creds :secret)
                         realm
                         (or url-request-method "GET")
                         (url-filename url)))))
      (if (and creds
               ;; Don't clear secret for `authsource' since it will
               ;; corrupt any future fetches for it.
               (not (eq (plist-get creds :source) 'authsource)))
          (clear-string (plist-get creds :secret))))))