21.1 Init Authentication

GNU Artanis provides flexible mechanism for authentication.

You can use #:auth mode to define a URL rule handler.

(get "/certain-rule" #:auth mode
     (lambda (rc) ...))

mode can be:

Available crypto-proc helper functions listed here:

(string->md5 <string>)
(string->sha-1 <string>)
(string->sha-224 <string>)
(string->sha-256 <string>)
(string->sha-384 <string>)
(string->sha-512 <string>)

NOTE: Please make sure that the username-field and passwd-field must be the same with the field name specifed in the submit form of you web page code.

For example, if there is a form on you page:

<input type="password" name="passwd">

Please notice that name of password input was specified to "passwd".

Then you should write authentication like this:

(post "/auth" #:auth '(table user "user" "passwd") #:session #t
      (lambda (rc) ...))

Please notice that the "passwd" here is the same with what you specified in the form.