all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Loading credentials from login keyring
@ 2020-12-29 19:33 Thomas Hisch
  2020-12-31 10:14 ` Ted Zlatanov
  2020-12-31 15:18 ` Michael Albinus
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Hisch @ 2020-12-29 19:33 UTC (permalink / raw)
  To: emacs-devel

[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-01 10:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-29 19:33 Loading credentials from login keyring Thomas Hisch
2020-12-31 10:14 ` 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

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.