[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: more on starttls, gnutls-cli and using tls for mail
From: |
Karl Fogel |
Subject: |
Re: more on starttls, gnutls-cli and using tls for mail |
Date: |
Tue, 27 Sep 2011 11:28:12 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Ted Zlatanov <address@hidden> writes:
>Heheh. OK. You really, really want a dynamic backend then. No
>problem.
>
>First, look at the definition of `auth-sources'. You need to augment
>the list of backends:
>
>[...]
Ted, thanks for this amazingly detailed mail! It'll be my starting
point. I wish I could start right away, but unfortunately can't, due to
time constraints. Once I do, I'll try to make something re-usable, and
leave the Info pages in better shape than I found them, to at least "pay
forward" for your valuable guidance.
-K
> (choice
> (string :tag "Just a file")
> (const :tag "Default Secrets API Collection" 'default)
> (const :tag "Login Secrets API Collection" "secrets:Login")
> (const :tag "Temp Secrets API Collection" "secrets:session")
>+ (const :tag "Karl's Dynamic Backend" 'dynamic-data)
>
>Then look at `auth-source-backend-parse'. Add your new backend to the
>cond statement so it's parsed properly. Here you can parse a string
>prefix like "dynamic-data:karl-dynamic-variable" (as the Sessions API does) so
>your users can point to a variable easily without customizing
>`auth-sources' too much. They would just have to add a string. The
>prefix doesn't have to match the backend name.
>
>The last step is to create your backend instance when needed and return
>it:
>
> (auth-source-backend
> (plist-get entry :source)
> :source (plist-get entry :source)
> :type 'dynamic-data
> :search-function 'auth-source-dynamic-data-search
> :create-function 'auth-source-dynamic-data-create)))
>
>Your create function can be a stub, that's not a problem.
>
>Finally your search function... Copy the `auth-source-netrc-search'
>template:
>
>(defun* auth-source-netrc-search (&rest
> spec
> &key backend require create delete
> type max host user port
> &allow-other-keys)
>
>1) the backend is the backend you created earlier, you'll need the
>"source" slot which in your case is e.g. karl-dynamic-variable. You'd
>map that to a symbol name and manipulate the value, obviously.
>
>2) require is a list of required keys
>
>3) max is the maximum number of results you should return
>
>4) create can be ignored if your create-function is a stub
>
>5) delete can be ignored if your backend doesn't delete entries,
>otherwise delete everything you found up to max
>
>6) host, user, port are the only search criteria accepted by the
>netrc/authinfo backend; yours could take more
>
>7) type is the backend type, you should return nothing if it's not
>dynamic-data (the `auth-source-search' caller may ask for this).
>
>If you want to allow creation, look at `auth-source-netrc-create'.
>There's a lot of code to deal with prompting that should IMO be factored
>out but I haven't had the time. It sounds like you'd be OK with letting
>the user modify the data externally though.
>
>Daiki Ueno went through this with his plstore backend so you're the
>second one to possibly write a custom backend. If it goes well for you
>I'll put these instructions in the auth-source texinfo pages.
>
>If you think this is too complicated or you're busy, I'll do it. Please
>let me know.
>
>Thanks
>Ted