all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thomas Hisch <t.hisch@gmail.com>
To: emacs-devel@gnu.org
Subject: Loading credentials from login keyring
Date: Tue, 29 Dec 2020 20:33:13 +0100	[thread overview]
Message-ID: <CA+e_QifoScYkmbsPL2ZPk8aYqoGh4h8S5+VgKJtj8PGsM=Y2fg@mail.gmail.com> (raw)

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

I'm the author of an elisp pkg [1] that talks via a REST API with a
server. For determining the credentials I use
`auth-source-user-and-password` in this elisp pkg.

Currently I store my credentials in an .authinfo file, but I
would like to read them from the keyring, since I already have
credentials for the service in the Login keyring.

I created the credentials using the python-keyring [2] pkg using the command

`keyring set hostname username`

The above command creates an entry in the Login keyring that has the
following schema (output of `M-x secrets-show-secrets`)

 `-[-] Password for ’thomas.hisch’ on ’hostname’
    |-  password:    ********** [Show password]
    |-  application: Python keyring library
    |-  service:     hostname
    |-  username:    thomas.hisch
    `-  xdg:schema:  org.freedesktop.Secret.Generic

The problem now is that `auth-source-user-and-password` doesn't find the
credentials in the "Login" keyring, i.e.,

(let ((auth-sources '("secrets:Login")))
  (auth-source-user-and-password "hostname"))

returns nil. The reason for this is that `auth-source-user-and-password`
searches for an entry with a plist key :host and not with the key :service.

I know that I can manually pass the search spec to `auth-source-search`,
but I want to keep the auth code in my pkg as high-level as
possible. I also don't want to break anything for
users that use different auth-sources.

Is the implementation of auth-source.el, e.g.
`auth-source-user-and-password`, supposed
to support reading of secrets stored in a keyring, which are not created by
emacs?

Best regards,
Thomas

[1] https://github.com/thisch/gerrit.el
[2] https://keyring.readthedocs.io/en/latest/

[-- Attachment #2: Type: text/html, Size: 2141 bytes --]

             reply	other threads:[~2020-12-29 19:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-29 19:33 Thomas Hisch [this message]
2020-12-31 10:14 ` Loading credentials from login keyring Ted Zlatanov
2020-12-31 15:19   ` Michael Albinus
2020-12-31 15:18 ` Michael Albinus
2021-01-01  9:08   ` Thomas Hisch
2021-01-01 10:25     ` Michael Albinus

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='CA+e_QifoScYkmbsPL2ZPk8aYqoGh4h8S5+VgKJtj8PGsM=Y2fg@mail.gmail.com' \
    --to=t.hisch@gmail.com \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.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.