9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Demetrius Iatrakis <demetrius.iatrakis@gmail.com>
To: 9front@9front.org
Subject: [9front] OAuth2 in factotum
Date: Mon, 16 Aug 2021 14:15:00 +0300	[thread overview]
Message-ID: <CALo7eEtm+pCjzsbSBA_ukjX-XoBaqTx+RgCE60V_29ZO0RmyKw@mail.gmail.com> (raw)

This is a preview of OAuth2 support in factotum, as part of this year's GSoC:
https://github.com/Mitsos101/plan9front/pull/1

Installation:

git/clone https://github.com/Mitsos101/plan9front plan9front-oauth
cd plan9front-oauth
git/branch oauth
bind sys/include /sys/include
@{cd sys/src/libauth && mk install}
@{cd sys/src/cmd/auth && mk install}
@{cd sys/src/cmd/webfs && mk install}

This will replace your factotum.

Usage:

You need to obtain OAuth credentials from your issuer first. See, for
example, Google's guide:
https://developers.google.com/identity/protocols/oauth2.

% echo 'key proto=oauth issuer=https://accounts.google.com scope=email
client_id=1234 !client_secret=5678' > /mnt/factotum/ctl
% auth/oauth 'client_id=1234'
go to https://google.com/device
your code is ABCD-EFGH
<after user consent is provided, the access token is printed>

auth_oauth is also available in libauth. Webfs uses it to implement
the preoauth command.

Bugs:

factotum uses the needkey RPC to display the verification URL and code
to the user. This means that, for now, the needkey file must not be
open so that fgui doesn't intercept it.

The module imports lots of code to support HTTP/1.0 so that the
refresh token doesn't leave factotum's address space.

Only the device and refresh flows are supported. There is an
implementation of the authorization code flow (tested on macOS) here:
https://github.com/Mitsos101/plan9port/pull/1. However, it is not
included in the module as there is no good browser to plumb the URL
to.

Refresh tokens are not saved to persistent storage when factotum
exits. The user must provide consent every time factotum is restarted.

-- 
Demetrius

                 reply	other threads:[~2021-08-17  2:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALo7eEtm+pCjzsbSBA_ukjX-XoBaqTx+RgCE60V_29ZO0RmyKw@mail.gmail.com \
    --to=demetrius.iatrakis@gmail.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).