sasl.texi 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. \input texinfo @c -*-texinfo-*-
  2. @include gnus-overrides.texi
  3. @setfilename ../../info/sasl.info
  4. @set VERSION 0.2
  5. @settitle Emacs SASL Library @value{VERSION}
  6. @include docstyle.texi
  7. @copying
  8. This file describes the Emacs SASL library, version @value{VERSION}.
  9. Copyright @copyright{} 2000, 2004--2017 Free Software Foundation, Inc.
  10. @quotation
  11. Permission is granted to copy, distribute and/or modify this document
  12. under the terms of the GNU Free Documentation License, Version 1.3 or
  13. any later version published by the Free Software Foundation; with no
  14. Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
  15. and with the Back-Cover Texts as in (a) below. A copy of the license
  16. is included in the section entitled ``GNU Free Documentation License''.
  17. (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
  18. modify this GNU manual.''
  19. @end quotation
  20. @end copying
  21. @dircategory Emacs network features
  22. @direntry
  23. * SASL: (sasl). The Emacs SASL library.
  24. @end direntry
  25. @titlepage
  26. @ifset WEBHACKDEVEL
  27. @title Emacs SASL Library @value{VERSION} (DEVELOPMENT VERSION)
  28. @end ifset
  29. @ifclear WEBHACKDEVEL
  30. @title Emacs SASL Library @value{VERSION}
  31. @end ifclear
  32. @author by Daiki Ueno
  33. @page
  34. @vskip 0pt plus 1filll
  35. @insertcopying
  36. @end titlepage
  37. @node Top
  38. @top Emacs SASL
  39. SASL is a common interface to share several authentication mechanisms between
  40. applications using different protocols.
  41. @ifnottex
  42. @insertcopying
  43. @end ifnottex
  44. @menu
  45. * Overview:: What Emacs SASL library is.
  46. * How to use:: Adding authentication support to your applications.
  47. * Data types::
  48. * Back end drivers:: Writing your own drivers.
  49. * GNU Free Documentation License:: The license for this documentation.
  50. * Index::
  51. * Function Index::
  52. * Variable Index::
  53. @end menu
  54. @node Overview
  55. @chapter Overview
  56. @sc{sasl} is short for @dfn{Simple Authentication and Security Layer}.
  57. This standard is documented in RFC2222. It provides a simple method for
  58. adding authentication support to various application protocols.
  59. The toplevel interface of this library is inspired by Java @sc{sasl}
  60. Application Program Interface. It defines an abstraction over a series
  61. of authentication mechanism drivers (@ref{Back end drivers}).
  62. Back end drivers are designed to be close as possible to the
  63. authentication mechanism. You can access the additional configuration
  64. information anywhere from the implementation.
  65. @node How to use
  66. @chapter How to use
  67. (Not yet written).
  68. To use Emacs SASL library, please evaluate following expression at the
  69. beginning of your application program.
  70. @lisp
  71. (require 'sasl)
  72. @end lisp
  73. If you want to check existence of sasl.el at runtime, instead you
  74. can list autoload settings for functions you want.
  75. @node Data types
  76. @chapter Data types
  77. There are three data types to be used for carrying a negotiated
  78. security layer---a mechanism, a client parameter and an authentication
  79. step.
  80. @menu
  81. * Mechanisms::
  82. * Clients::
  83. * Steps::
  84. @end menu
  85. @node Mechanisms
  86. @section Mechanisms
  87. A mechanism (@code{sasl-mechanism} object) is a schema of the @sc{sasl}
  88. authentication mechanism driver.
  89. @defvar sasl-mechanisms
  90. A list of mechanism names.
  91. @end defvar
  92. @defun sasl-find-mechanism mechanisms
  93. Retrieve an appropriate mechanism.
  94. This function compares @var{mechanisms} and @code{sasl-mechanisms} then
  95. returns appropriate @code{sasl-mechanism} object.
  96. @example
  97. (let ((sasl-mechanisms '("CRAM-MD5" "DIGEST-MD5")))
  98. (setq mechanism (sasl-find-mechanism server-supported-mechanisms)))
  99. @end example
  100. @end defun
  101. @defun sasl-mechanism-name mechanism
  102. Return name of mechanism, a string.
  103. @end defun
  104. If you want to write an authentication mechanism driver (@ref{Back end
  105. drivers}), use @code{sasl-make-mechanism} and modify
  106. @code{sasl-mechanisms} and @code{sasl-mechanism-alist} correctly.
  107. @defun sasl-make-mechanism name steps
  108. Allocate a @code{sasl-mechanism} object.
  109. This function takes two parameters---name of the mechanism, and a list
  110. of authentication functions.
  111. @example
  112. (defconst sasl-anonymous-steps
  113. '(identity ;no initial response
  114. sasl-anonymous-response))
  115. (put 'sasl-anonymous 'sasl-mechanism
  116. (sasl-make-mechanism "ANONYMOUS" sasl-anonymous-steps))
  117. @end example
  118. @end defun
  119. @node Clients
  120. @section Clients
  121. A client (@code{sasl-client} object) initialized with four
  122. parameters---a mechanism, a user name, name of the service and name of
  123. the server.
  124. @defun sasl-make-client mechanism name service server
  125. Prepare a @code{sasl-client} object.
  126. @end defun
  127. @defun sasl-client-mechanism client
  128. Return the mechanism (@code{sasl-mechanism} object) of client.
  129. @end defun
  130. @defun sasl-client-name client
  131. Return the authorization name of client, a string.
  132. @end defun
  133. @defun sasl-client-service client
  134. Return the service name of client, a string.
  135. @end defun
  136. @defun sasl-client-server client
  137. Return the server name of client, a string.
  138. @end defun
  139. If you want to specify additional configuration properties, please use
  140. @code{sasl-client-set-property}.
  141. @defun sasl-client-set-property client property value
  142. Add the given property/value to client.
  143. @end defun
  144. @defun sasl-client-property client property
  145. Return the value of the property of client.
  146. @end defun
  147. @defun sasl-client-set-properties client plist
  148. Destructively set the properties of client.
  149. The second argument is the new property list.
  150. @end defun
  151. @defun sasl-client-properties client
  152. Return the whole property list of client configuration.
  153. @end defun
  154. @node Steps
  155. @section Steps
  156. A step (@code{sasl-step} object) is an abstraction of authentication
  157. ``step'' which holds the response value and the next entry point for the
  158. authentication process (the latter is not accessible).
  159. @defun sasl-step-data step
  160. Return the data which @var{step} holds, a string.
  161. @end defun
  162. @defun sasl-step-set-data step data
  163. Store @var{data} string to @var{step}.
  164. @end defun
  165. To get the initial response, you should call the function
  166. @code{sasl-next-step} with the second argument @code{nil}.
  167. @example
  168. (setq name (sasl-mechanism-name mechanism))
  169. @end example
  170. At this point we could send the command which starts a SASL
  171. authentication protocol exchange. For example,
  172. @example
  173. (process-send-string
  174. process
  175. (if (sasl-step-data step) ;initial response
  176. (format "AUTH %s %s\r\n" name (base64-encode-string (sasl-step-data step) t))
  177. (format "AUTH %s\r\n" name)))
  178. @end example
  179. To go on with the authentication process, all you have to do is call
  180. @code{sasl-next-step} consecutively.
  181. @defun sasl-next-step client step
  182. Perform the authentication step.
  183. At the first time @var{step} should be set to @code{nil}.
  184. @end defun
  185. @node Back end drivers
  186. @chapter Back end drivers
  187. (Not yet written).
  188. @node GNU Free Documentation License
  189. @appendix GNU Free Documentation License
  190. @include doclicense.texi
  191. @node Index
  192. @unnumbered Index
  193. @printindex cp
  194. @node Function Index
  195. @unnumbered Function Index
  196. @printindex fn
  197. @node Variable Index
  198. @unnumbered Variable Index
  199. @printindex vr
  200. @summarycontents
  201. @contents
  202. @bye
  203. @c End: