all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#56404] [PATCH 0/2] gnu: Add python-msal and oauth2ms.
@ 2022-07-05 17:22 John Kehayias via Guix-patches via
  2022-07-05 17:24 ` [bug#56404] [PATCH 1/2] gnu: Add python-msal John Kehayias via Guix-patches via
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2022-07-05 17:22 UTC (permalink / raw)
  To: 56404

Hello Guix,

Here are two straight forward patches to add python-msal and oauth2ms. Short commentary:

1. python-msal: a package for Microsoft authentication tokens. Tests were disabled because most/all needed network access, and could only disable some of these tests with an environment variable. I did use the GitHub source since it includes tests, in case this can be better worked around in the future, or if using the source directly.

2. oauth2ms: a python script to use msal in order to have usable tokens, like needing oauth2 tokens for getting/sending mail with multi-factor authentication required email services. I copied the readme and steps.org which have documentation for setting this up to the appropriate doc folder. There is no release or version tag and the script needed to be wrapped.

As a final note, I've used this to send mail through my university email server that uses Microsoft Office 365 with multi-factor authentication (so you can't use your password or an app password). oauth2ms provides instructions for doing this in emacs, which I used for mu4e. And if you can't create the needed keys in Azure (as I couldn't) you can use Thunderbird's https://hg.mozilla.org/comm-central/file/tip/mailnews/base/src/OAuth2Providers.jsm#l127 along with your providers "tenet id" which I could find by logging on to Azure even without permissions to create an app.

Hope someone else finds this useful!
John




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#56404] [PATCH 1/2] gnu: Add python-msal.
  2022-07-05 17:22 [bug#56404] [PATCH 0/2] gnu: Add python-msal and oauth2ms John Kehayias via Guix-patches via
@ 2022-07-05 17:24 ` John Kehayias via Guix-patches via
  2022-07-05 17:25 ` [bug#56404] [PATCH 2/2] gnu: Add oauth2ms John Kehayias via Guix-patches via
  2022-07-17 19:41 ` bug#56404: [PATCH 0/2] gnu: Add python-msal and oauth2ms Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2022-07-05 17:24 UTC (permalink / raw)
  To: 56404@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 13 bytes --]

Empty Message

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-python-msal.patch --]
[-- Type: text/x-patch; name=0001-gnu-Add-python-msal.patch, Size: 2219 bytes --]

From 4667c19525d5a2e602e13fde46120d4dcac0d6b9 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 5 Jul 2022 13:12:43 -0400
Subject: [PATCH 1/2] gnu: Add python-msal.

* gnu/packages/python-web.scm (python-msal): New variable.
---
 gnu/packages/python-web.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 6f951595c8..a2dcf49569 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -2954,6 +2954,38 @@ (define-public python-requests-ftp
 adapter for use with the Requests library.")
     (license license:asl2.0)))
 
+(define-public python-msal
+  (package
+    (name "python-msal")
+    (version "1.18.0")
+    (home-page
+     "https://github.com/AzureAD/microsoft-authentication-library-for-python")
+    (source (origin
+              (method git-fetch)
+              ;; Pypi does not have tests.
+              (uri (git-reference (url home-page) (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "02d9vlvp08q1yffgn7a0y19451py1jly67q5ld6m2d9xidbrvac1"))))
+    (build-system python-build-system)
+    (arguments
+     ;; Tests (all?) rely on network access and only some can be disabled by
+     ;; setting the environment variable TRAVIS_TAG.
+     (list #:tests? #f))
+    (native-inputs (list python-mock))
+    (propagated-inputs (list python-cryptography python-pyjwt python-requests))
+    (synopsis "Microsoft Authentication Library (MSAL) for Python")
+    (description
+     "The Microsoft Authentication Library for Python enables applications to
+integrate with the Microsoft identity platform.  It allows you to sign in
+users or apps with Microsoft identities (Azure AD, Microsoft Accounts and
+Azure AD B2C accounts) and obtain tokens to call Microsoft APIs such as
+Microsoft Graph or your own APIs registered with the Microsoft identity
+platform.  It is built using industry standard OAuth2 and OpenID Connect
+protocols.")
+    (license license:expat)))
+
 (define-public python-oauthlib
   (package
     (name "python-oauthlib")
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#56404] [PATCH 2/2] gnu: Add oauth2ms.
  2022-07-05 17:22 [bug#56404] [PATCH 0/2] gnu: Add python-msal and oauth2ms John Kehayias via Guix-patches via
  2022-07-05 17:24 ` [bug#56404] [PATCH 1/2] gnu: Add python-msal John Kehayias via Guix-patches via
@ 2022-07-05 17:25 ` John Kehayias via Guix-patches via
  2022-07-17 19:41 ` bug#56404: [PATCH 0/2] gnu: Add python-msal and oauth2ms Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2022-07-05 17:25 UTC (permalink / raw)
  To: 56404@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 13 bytes --]

Empty Message

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-oauth2ms.patch --]
[-- Type: text/x-patch; name=0002-gnu-Add-oauth2ms.patch, Size: 3470 bytes --]

From 316c05e7519c0d9fc3ccefbb89dbfcc19104d3c1 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 5 Jul 2022 13:13:07 -0400
Subject: [PATCH 2/2] gnu: Add oauth2ms.

* gnu/packages/python-web.scm (oauth2ms): New variable.
---
 gnu/packages/python-web.scm | 41 +++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index a2dcf49569..834b40fc58 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -73,16 +73,20 @@ (define-module (gnu packages python-web)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system python)
   #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages django)
+  #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gnupg)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages libevent)
@@ -2986,6 +2990,43 @@ (define-public python-msal
 protocols.")
     (license license:expat)))
 
+(define-public oauth2ms
+  (let ((commit "a1ef0cabfdea57e9309095954b90134604e21c08") (revision "0"))
+    (package
+      (name "oauth2ms")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/harishkrupo/oauth2ms")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0dqi6n4npdrvb42r672n4sl1jl8z5lsk554fwiiihpj0faa9dx64"))))
+      (build-system copy-build-system)
+      (arguments
+       (list #:install-plan #~`(("oauth2ms" "bin/oauth2ms")
+                                ("."
+                                 #$(string-append "share/doc/" name "-" version "/")
+                                 #:include-regexp ("\\.org$")))
+             #:phases #~(modify-phases %standard-phases
+                          (add-after 'install 'wrap-pythonpath
+                            (lambda* (#:key inputs outputs #:allow-other-keys)
+                              (let ((path (getenv "GUIX_PYTHONPATH")))
+                                (wrap-program (string-append #$output
+                                                             "/bin/oauth2ms")
+                                              `("GUIX_PYTHONPATH" ":" prefix
+                                                (,path)))))))))
+      (inputs (list bash-minimal python python-gnupg python-msal python-pyxdg))
+      (home-page "https://github.com/harishkrupo/oauth2ms")
+      (synopsis "XOAUTH2 compatible Microsoft Office 365 token fetcher")
+      (description
+       "Oauth2ms can be used to fetch OAuth 2.0 tokens from the Microsoft Identity
+endpoint.  Additionally, it can encode the token in the XOAUTH2 format to be
+used as authentication in IMAP mail servers.")
+      (license license:asl2.0))))
+
 (define-public python-oauthlib
   (package
     (name "python-oauthlib")
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#56404: [PATCH 0/2] gnu: Add python-msal and oauth2ms.
  2022-07-05 17:22 [bug#56404] [PATCH 0/2] gnu: Add python-msal and oauth2ms John Kehayias via Guix-patches via
  2022-07-05 17:24 ` [bug#56404] [PATCH 1/2] gnu: Add python-msal John Kehayias via Guix-patches via
  2022-07-05 17:25 ` [bug#56404] [PATCH 2/2] gnu: Add oauth2ms John Kehayias via Guix-patches via
@ 2022-07-17 19:41 ` Ludovic Courtès
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2022-07-17 19:41 UTC (permalink / raw)
  To: John Kehayias; +Cc: 56404-done

Hello John,

John Kehayias <john.kehayias@protonmail.com> skribis:

> Here are two straight forward patches to add python-msal and oauth2ms.

Applied, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-17 19:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 17:22 [bug#56404] [PATCH 0/2] gnu: Add python-msal and oauth2ms John Kehayias via Guix-patches via
2022-07-05 17:24 ` [bug#56404] [PATCH 1/2] gnu: Add python-msal John Kehayias via Guix-patches via
2022-07-05 17:25 ` [bug#56404] [PATCH 2/2] gnu: Add oauth2ms John Kehayias via Guix-patches via
2022-07-17 19:41 ` bug#56404: [PATCH 0/2] gnu: Add python-msal and oauth2ms Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.