16.1 Init Authentication
GNU Artanis provides flexible mechanism for authentication.
You have to use #:auth mode while you defining URL rule handler.
(get "/certain-rule" #:auth mode
(lambda (rc) ...))
mode could be:
- SQL as string template. You may write your own customized SQL for fetching & checking username and passwd.
- (’basic (lambda (rc user passwd) …)) init a Basic Authentication mode. user is submitted username, passwd is submitted password value.
- (’table table-name username-field passwd-field) init a common Authentication mode. The passwd will be encrypted by default algorithm.
- (’table table-name username-field passwd-field crypto-proc) similar to the above item, but encrypt passwd with crypto-proc.
- (table-name crypto-proc), so passwd field will be "passwd" and username will be "username" in default, and you may encrypt passwd with crypto-proc.
Available crypto-proc helper functions listed here:
- (string->md5 str)
- (string->sha-1 str)