git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add a credential-helper for KDE

From
Jeff King <peff@peff.net>
Date
Aug 31, 2011, 01:42 UTC
Message-ID
<20110831014237.GA2519@sigill.intra.peff.net>
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.
Show 10 quoted lines
> +    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
Previous: Lukas SandströmNext: Lukas Sandström
Message 2 of 5 in “Add a credential-helper for KDE”
  1. Add a credential-helper for KDELukas Sandström, Aug 27, 2011
  2. Jeff KingAug 31, 2011
  3. Add a credential-helper for KDELukas Sandström, Sep 18, 2011
  4. Jeff KingSep 18, 2011
  5. Jeff KingSep 30, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.