branch: externals/url-http-oauth commit 85ea04418c810bb9ecf64f5a85fefc0a719e962f Author: Thomas Fitzsimmons <fitz...@fitzsim.org> Commit: Thomas Fitzsimmons <fitz...@fitzsim.org>
url-http-oauth.el: New package * url-http-oauth.el: New package. * .gitignore: Ignore autogenerated files. --- .gitignore | 3 +++ url-http-oauth.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..0a4f7ee4c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/url-http-oauth-pkg.el +/url-http-oauth-autoloads.el +*.elc diff --git a/url-http-oauth.el b/url-http-oauth.el new file mode 100644 index 0000000000..ba0916d30f --- /dev/null +++ b/url-http-oauth.el @@ -0,0 +1,51 @@ +;;; url-http-oauth.el --- Add OAuth 2.0 authentication support to URL library -*- lexical-binding: t -*- + +;; Copyright (C) 2023 Free Software Foundation, Inc. + +;; Author: Thomas Fitzsimmons <fitz...@fitzsim.org> +;; Version: 0 +;; Keywords: comm, data, processes, hypermedia + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; +;; This package provides an OAuth 2.0 handler for Emacs's URL library. +;; +;; Installation: +;; +;; M-x package-install RET url-http-oauth RET + +;;; Code: +(require 'url-auth) +(require 'url-http) +(require 'url-util) + +(defvar url-http-oauth--registered-oauth-urls nil + "A hash table mapping URL strings to lists of OAuth 2.0 configuration items.") + +;;; Public function called by `url-get-authentication'. +;;;###autoload +(defun url-oauth-auth (url &optional _prompt _overwrite _realm _args) + "Return an OAuth 2.0 HTTP authorization header. +URL is a structure representing a parsed URL." + nil) + +;;; Register `url-oauth-auth' HTTP authentication method. +;;;###autoload +(url-register-auth-scheme "oauth" nil 9) + +(provide 'url-http-oauth) + +;;; url-http-oauth.el ends here