[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/url-http-oauth d86dbb478d 23/24: Retest against sourceh
From: |
Thomas Fitzsimmons |
Subject: |
[elpa] externals/url-http-oauth d86dbb478d 23/24: Retest against sourcehut, fix new issues |
Date: |
Mon, 8 May 2023 21:10:48 -0400 (EDT) |
branch: externals/url-http-oauth
commit d86dbb478d2eccebf276c554eebe8c6c53c67f89
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Retest against sourcehut, fix new issues
* url-http-oauth.el (url-http-oauth--update-regexp): Check for nil
resource-url and resource-url-prefixes entries.
(url-http-oauth--get-access-token-grant): Add missing nil argument
to url-http-oauth--auth-source-search call. Make last argument to
apply a list. Do not include client identifier in request body if
it is already in the authorization header.
(url-http-oauth--expiry-string): Handle expiry being a number
instead of a string.
---
url-http-oauth.el | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/url-http-oauth.el b/url-http-oauth.el
index 4ca678314e..9e25ed7c6d 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -85,9 +85,14 @@ URL is an object or a string."
"Update `url-http-oauth--interposed-regexp'."
(let (all-urls)
(dolist (settings url-http-oauth--interposed)
- (push (cdr (assoc "resource-url" settings)) all-urls)
- (dolist (prefix (cdr (assoc "resource-url-prefixes" settings)))
- (push prefix all-urls)))
+ (let ((resource-url (cdr (assoc "resource-url" settings)))
+ (resource-url-prefixes
+ (cdr (assoc "resource-url-prefixes" settings))))
+ (when resource-url
+ (push resource-url all-urls))
+ (when resource-url-prefixes
+ (dolist (prefix resource-url-prefixes)
+ (push prefix all-urls)))))
(setq url-http-oauth--interposed-regexp (regexp-opt all-urls))))
;; Maybe if RFC 8414, "OAuth 2.0 Authorization Server Metadata",
@@ -250,7 +255,7 @@ endpoint."
(auth-result
(when client-secret-method
(url-http-oauth--auth-source-search
- access-token-url client-identifier
+ access-token-url client-identifier nil
"Client secret for %u at %h: ")))
(client-secret (url-http-oauth--auth-info-password auth-result))
(save-function (plist-get auth-result :save-function))
@@ -263,14 +268,19 @@ endpoint."
(url-request-extra-headers
(apply #'list
(cons "Content-Type" "application/x-www-form-urlencoded")
- (when authorization (cons "Authorization" authorization))))
+ (when authorization
+ (list (cons "Authorization" authorization)))))
(redirect-uri
(cdr (assoc "redirect_uri" (cdr (assoc
"authorization-extra-arguments"
url-settings)))))
(url-request-data
(url-build-query-string
(apply #'list (list "code" code)
- (list "client_id" client-identifier)
+ (when (not authorization)
+ ;; Client identifier is included in authorization
+ ;; string. Some services object to it also being
+ ;; in the body.
+ (list "client_id" client-identifier))
(list "grant_type" "authorization_code")
(when redirect-uri
(list (list "redirect_uri" redirect-uri)))))))
@@ -289,7 +299,9 @@ endpoint."
The time is in seconds since the epoch."
(let ((expiry (gethash "expires_in" grant)))
(unless expiry (error "url-http-oauth: Did not find expiry time in grant"))
- (format-time-string "%s" (time-add nil (string-to-number expiry)))))
+ (format-time-string "%s" (time-add nil (if (stringp expiry)
+ (string-to-number expiry)
+ expiry)))))
(defun url-http-oauth--refresh-token-string (grant)
"Return the refresh token from GRANT.
- [elpa] externals/url-http-oauth e104630233 11/24: Convert to URL settings alist, (continued)
- [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, 2023/05/08
- [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 <=
- [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
- [elpa] externals/url-http-oauth 0bf4a7633d 08/24: Complete confidential client support, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth b884e725af 05/24: Get basics working for Sourcehut, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 38157dfb3a 09/24: Reduce overloading of "register", Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth e1408ed406 02/24: Implement provider registration, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth f5b953197b 15/24: Fix auth-source-search for path and scope, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 40c46af10c 24/24: Bump version to 0.8.0, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth e95f685771 06/24: Begin auth-source implementation, Thomas Fitzsimmons, 2023/05/08
- [elpa] externals/url-http-oauth 1ecb40b545 17/24: Make some adjustments based on testing, Thomas Fitzsimmons, 2023/05/08