[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/url-http-oauth 7e825a8765 21/24: Allow per-provider use
|
From: |
Thomas Fitzsimmons |
|
Subject: |
[elpa] externals/url-http-oauth 7e825a8765 21/24: Allow per-provider user-agent interaction function |
|
Date: |
Mon, 8 May 2023 21:10:48 -0400 (EDT) |
branch: externals/url-http-oauth
commit 7e825a876548502a52107048e6f8a8ab49e0f2c9
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Allow per-provider user-agent interaction function
* url-http-oauth.el (url-http-oauth-interpose): Document
authorization-code-function.
(url-http-oauth--retrieve-and-save-bearer): Use
authorization-code-function if it is provided in settings.
---
url-http-oauth.el | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/url-http-oauth.el b/url-http-oauth.el
index b0ef7dcfe5..30e0007ce3 100644
--- a/url-http-oauth.el
+++ b/url-http-oauth.el
@@ -129,7 +129,11 @@ pairs that will be appended to the authorization URL.
Specific
pairs in this list are not standardized but may be required or
recommended by the OAuth 2.0 provider. Examples of string types
include RESOURCE, RESPONSE_MODE, LOGIN_HINT, PROMPT and
-REDIRECT_URI."
+REDIRECT_URI.
+
+AUTHORIZATION-CODE-FUNCTION is an elisp function that takes an
+authorization URL as a string argument, and returns, as a string,
+a full URL containing a code value in its query string."
(let* ((client-secret-method
(cdr (assoc "client-secret-method" url-settings))))
(unless (or (eq client-secret-method 'prompt) (eq client-secret-method
nil))
@@ -485,11 +489,15 @@ Save the bearer token to `auth-sources' then return it."
(defun url-http-oauth--retrieve-and-save-bearer (url url-settings)
"Retrieve the bearer token required for URL, using URL-SETTINGS.
Save the bearer token to `auth-sources' upon success."
- (let* ((response-url
- ;; FIXME: Make this a per-provider function.
- (read-from-minibuffer
- (format "Browse to %s and paste the redirected code URL: "
- (url-http-oauth--authorization-url url-settings))))
+ (let* ((authorization-code-function
+ (cdr (assoc "authorization-code-function" url-settings)))
+ (authorization-url (url-http-oauth--authorization-url url-settings))
+ (response-url
+ (if (functionp authorization-code-function)
+ (funcall authorization-code-function authorization-url)
+ (read-from-minibuffer
+ (format "Browse to %s and paste the redirected code URL: "
+ authorization-url))))
(code
(url-http-oauth--extract-authorization-code response-url))
(grant (url-http-oauth--get-access-token-grant url-settings code)))
- [elpa] externals/url-http-oauth 85ea04418c 01/24: url-http-oauth.el: New package, (continued)
- [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, 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 <=
- [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
- [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