From: Jeff King <peff@peff.net>
To: "Lukas Sandström" <luksan@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Add a credential-helper for KDE
Date: Tue, 30 Aug 2011 21:42:37 -0400 [thread overview]
Message-ID: <20110831014237.GA2519@sigill.intra.peff.net> (raw)
In-Reply-To: <4E594B5A.6070902@gmail.com>
On Sat, Aug 27, 2011 at 09:54:02PM +0200, Lukas Sandström wrote:
> This Python script plugs into the credentials API
> of Git to ask the user for passwords with a nice
> KDE password dialog.
Thanks for working on this.
> .../git-kde-credentials-helper.py | 122 ++++++++++++++++++++
Can we call it git-credential-kdewallet or similar? Then users can just
do:
git config credential.helper kdewallet
(where "kdewallet" can be whatever you think is most appropriate; the
key is naming it git-credential-*).
> 1 files changed, 122 insertions(+), 0 deletions(-)
> create mode 100755 contrib/kde-credetials-helper/git-kde-credentials-helper.py
Minor typo in directory name.
> + def check_wallet(self):
> + (res, data) = self.wallet.readMap(self.token)
> + if res != 0:
> + return None
> + try:
> + self.username = data[QString("username")]
> + self.password = data[QString("password")]
> + except KeyError:
> + return None
> + return self.username and self.password
If I am reading this correctly, you look up based purely on the context
token. Which means that if I do something like this:
$ git push https://host.com/repo.git
[enter username: user1, password: foo]
$ git push https://user2@host.com/other-repo.git
We will invoke the helper as:
git credential-kdewallet --unique=https:host.com --username=user2
but the helper will ignore the "user2" bit, and return "user1 / foo".
The "cache" helper I wrote handles this situation better, by indexing
both on the token and the username. I wonder if the username should
become part of the token. Or if the token should really just become a
canonicalized URL, minus the actual path. So the first one would get:
--unique=https://host.com
and the second would get:
--unique=https://user2@host.com
Then helpers wouldn't need to worry about doing anything special.
What do you think? Also, any comments in general on writing a helper?
You are the first one besides me to do so. Did you find anything in the
interface or the documentation confusing? Suggestions are very welcome,
as nothing has been released yet and we're free to tweak as much as we
want.
-Peff
next prev parent reply other threads:[~2011-08-31 1:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-27 19:54 [PATCH] Add a credential-helper for KDE Lukas Sandström
2011-08-31 1:42 ` Jeff King [this message]
2011-09-18 14:52 ` [PATCH v2] " Lukas Sandström
2011-09-18 18:49 ` Jeff King
2011-09-30 10:21 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110831014237.GA2519@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=luksan@gmail.com \
/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).