[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/url-http-oauth 9d5c820c90 14/24: Fix auth-source lookup
From: |
Thomas Fitzsimmons |
Subject: |
[elpa] externals/url-http-oauth 9d5c820c90 14/24: Fix auth-source lookups |
Date: |
Mon, 8 May 2023 21:10:46 -0400 (EDT) |
branch: externals/url-http-oauth
commit 9d5c820c9025405637a455fc359b4a3fd03c5919
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Fix auth-source lookups
* url-http-oauth.el (url-http-oauth-port): Always return the port
as a string.
(url-http-oauth-get-bearer): Use empty string for null user.
---
url-http-oauth.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/url-http-oauth.el b/url-http-oauth.el
index 6d2f68c5d7..8ec20bc314 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -102,7 +102,10 @@ This function does the opposite of
`url-http-oauth-interpose'."
(defun url-http-oauth-port (url)
"Return port of URL object.
Assume an HTTPS URL that does not specify a port uses 443."
- (or (url-port url) (when (string= "https" (url-type url)) 443)))
+ (let ((port-number (url-port url)))
+ (if port-number
+ (number-to-string port-number)
+ (when (string= "https" (url-type url)) "443"))))
(defun url-http-oauth-get-access-token-grant (url code)
"Get an access token for URL using CODE."
@@ -202,7 +205,7 @@ URL is a parsed object."
(car
(let ((auth-source-do-cache nil))
(auth-source-search
- :user (url-user url)
+ :user (or (url-user url) "")
:host (url-host url)
:port (url-http-oauth-port url)
:path path
@@ -222,7 +225,7 @@ URL is a parsed object."
(bearer-retrieved (gethash "access_token" grant))
(auth-result (let ((auth-source-do-cache nil))
(auth-source-search
- :user (url-user url)
+ :user (or (url-user url) "")
:host (url-host url)
:port (url-http-oauth-port url)
:path path
@@ -238,7 +241,7 @@ URL is a parsed object."
:create '(path scope expiry)
:max 1)))
(save-function (plist-get (car auth-result) :save-function)))
- ;; Success; save bearer.
+ ;; Success; save bearer.
(when (functionp save-function)
(funcall save-function))
bearer-retrieved))))
- [elpa] branch externals/url-http-oauth created (now 40c46af10c), Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 85ea04418c 01/24: url-http-oauth.el: New package, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth cd6df20689 03/24: Implement authorization and access-token steps, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth e104630233 11/24: Convert to URL settings alist, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 334e644a43 07/24: Finish bearer proof-of-concept, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 9d5c820c90 14/24: Fix auth-source lookups,
Thomas Fitzsimmons <=
- [elpa] externals/url-http-oauth 972011f217 04/24: Shorten header line to fit into 80 columns, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 8719575647 10/24: Add scope argument to top-level interpose function, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 3b3f9fe53f 12/24: Support extra arguments on authorization URL, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 8601d89d43 18/24: Complete regexp, list and token refresh design, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth ee73bb0450 19/24: Make functions private, fix some bugs, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 7e825a8765 21/24: Allow per-provider user-agent interaction function, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 9b2af487e3 22/24: Use relative expiry time in seconds, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth d86dbb478d 23/24: Retest against sourcehut, fix new issues, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 4441b79a9a 13/24: Remove explicit extra argument handling, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 085d57961a 20/24: Make message formatting consistent, Thomas Fitzsimmons, 2023/05/08