* How to non-interactively provide auth info to URL, and how to force URL to use HTTP AUTH
@ 2009-12-15 20:02 Edward O'Connor
2009-12-16 0:36 ` Juri Linkov
2009-12-16 6:30 ` Ari Roponen
0 siblings, 2 replies; 4+ messages in thread
From: Edward O'Connor @ 2009-12-15 20:02 UTC (permalink / raw)
To: emacs-devel
Hi,
I've made a lot of use out of url.el over the years, and it's for the
most part been a nice experience. But I haven't been able to wrap my
brain around how to use HTTP AUTH in a nice-to-the-user way.
Here's the scenario: I work on several elisp clients for various APIs
which are exposed via HTTP and make use of HTTP AUTH. When a developer
uses my library, they supply the relevant auth info to my library
explicitly. I would then like to invoke url-retreive and have the
resulting request use basic (or digest) auth with the auth info I
already have, *without prompting the user* for a username or password. I
keep failing to figure out how to do this.
I'd really rather not resort to shelling out to curl, but this is *very
easy* to do with curl (a simple "curl -u user:pass url-to-api-call" will
do), and it's not at all clear how to do it with url.el.
Any suggestions on how to proceed would be most welcome!
Thanks,
Ted
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to non-interactively provide auth info to URL, and how to force URL to use HTTP AUTH
2009-12-15 20:02 How to non-interactively provide auth info to URL, and how to force URL to use HTTP AUTH Edward O'Connor
@ 2009-12-16 0:36 ` Juri Linkov
2009-12-16 8:56 ` Andreas Schwab
2009-12-16 6:30 ` Ari Roponen
1 sibling, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2009-12-16 0:36 UTC (permalink / raw)
To: Edward O'Connor; +Cc: emacs-devel
> Any suggestions on how to proceed would be most welcome!
A comment in the CVS revision 7.7 of gnus/auth-source.el used to say:
;;; For url-auth authentication (HTTP/HTTPS), you need to use:
;;;
;;; machine yourmachine.com:80 port http login testuser password testpass
;;;
;;; This will match any realm and authentication method (basic or
;;; digest). If you want finer controls, explore the url-auth source
;;; code and variables.
I don't know why it was removed and whether it currently supports
HTTP authentication (looking at the source code of lisp/url/url-auth.el
that uses gnus/auth-source.el, it seems this should work).
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to non-interactively provide auth info to URL, and how to force URL to use HTTP AUTH
2009-12-15 20:02 How to non-interactively provide auth info to URL, and how to force URL to use HTTP AUTH Edward O'Connor
2009-12-16 0:36 ` Juri Linkov
@ 2009-12-16 6:30 ` Ari Roponen
1 sibling, 0 replies; 4+ messages in thread
From: Ari Roponen @ 2009-12-16 6:30 UTC (permalink / raw)
To: emacs-devel
Hi,
"Edward O'Connor" <hober0@gmail.com> writes:
> Here's the scenario: I work on several elisp clients for various APIs
> which are exposed via HTTP and make use of HTTP AUTH. When a developer
> uses my library, they supply the relevant auth info to my library
> explicitly. I would then like to invoke url-retreive and have the
> resulting request use basic (or digest) auth with the auth info I
> already have, *without prompting the user* for a username or password. I
> keep failing to figure out how to do this.
I have used something like this to get status information from my
ADSL-modem. I don't know if it is the right thing, but it has worked for
me.
(defvar telewell-default-auth
`(("192.168.0.254:80"
("WebAdmin" . ,(base64-encode-string "admin:password"))))
"Default authorization data for Telewell ADSL modem.")
(defun telewell-get-data ()
(let* ((url-show-status nil)
(url-basic-auth-storage 'telewell-default-auth)
(buf (url-retrieve-synchronously
"http://192.168.0.254/adsl.asp")))
(when buf
...)))
--
Ari Roponen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to non-interactively provide auth info to URL, and how to force URL to use HTTP AUTH
2009-12-16 0:36 ` Juri Linkov
@ 2009-12-16 8:56 ` Andreas Schwab
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2009-12-16 8:56 UTC (permalink / raw)
To: Juri Linkov; +Cc: Edward O'Connor, emacs-devel
Juri Linkov <juri@jurta.org> writes:
> I don't know why it was removed
It was duplicated in auth.texi.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-16 8:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-15 20:02 How to non-interactively provide auth info to URL, and how to force URL to use HTTP AUTH Edward O'Connor
2009-12-16 0:36 ` Juri Linkov
2009-12-16 8:56 ` Andreas Schwab
2009-12-16 6:30 ` Ari Roponen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).