git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Christian Halstrick <christian.halstrick@gmail.com>,
	Git <git@vger.kernel.org>
Subject: Re: OAuth2 support in git?
Date: Mon, 18 Jun 2018 17:26:14 -0400	[thread overview]
Message-ID: <20180618212614.GA2504@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqo9g8xf9k.fsf@gitster-ct.c.googlers.com>

On Mon, Jun 18, 2018 at 08:53:27AM -0700, Junio C Hamano wrote:

> > Yeah, that will work for some cases. A few places it might not:
> >
> >  - some people may want to provide this only in response to a 401
> >
> >  - some tokens may need to be refreshed, which would require interacting
> >    with a credential helper to do the rest of the oauth conversation
> >
> >  - there's no good way to hide your token in secure storage (versus
> >    sticking it on the command-line or in a config file).
> 
> And all of these three are what you get for free by building on the
> credential helper framework, after extending it a bit so that the
> filled credential structure can tell the http code to show it to the
> other side as a bearer token, not a password or password hash.  The
> helper is asked to supply the auth material only after 401, which
> covers both the first and the second points, and then keeping the
> auth material in-core (e.g. cache--daemon) would be more secure
> which covers the third point.  Am I following you correctly?

Yes, exactly.

Even if the credential protocol itself doesn't learn about this feature,
even a config option for "treat password as token to send via bearer"
would help. The "how" of sending the token isn't secret, just the token
itself. So everything else can just pretend it's a password (it's a
little funny because I think there isn't a matching username, but you
could probably get by with an empty one).

That's all just off the top of my head without digging back into the
code, nor running any experiments, of course. There may be some gotchas. :)

-Peff

  reply	other threads:[~2018-06-18 21:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-14  8:09 OAuth2 support in git? Christian Halstrick
2018-06-14 10:13 ` brian m. carlson
2018-06-14 15:15   ` Jeff King
2018-06-14 20:46     ` Randall S. Becker
2018-06-14 21:01       ` Jeff King
2018-06-14 22:20     ` brian m. carlson
2018-06-17 11:37     ` Johannes Schindelin
2018-06-18  4:17       ` Jeff King
2018-06-18 15:53         ` Junio C Hamano
2018-06-18 21:26           ` Jeff King [this message]
2018-06-19 12:36             ` Christian Halstrick
2018-06-19 16:45               ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20180618212614.GA2504@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=christian.halstrick@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sandals@crustytoothpaste.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).