carlssonia/snap-core — comment on commit 99e2365935b3e92d27b0881bc94c164ff4dda584
File: src/Snap/Internal/Http/Types.hs line 451
By gregorycollins:

Thanks for tackling this. First of all: I think this code should go into a new module `Snap.Util.HttpAuthentication' rather than getting lumped into `Snap.Core`.

Secondly: I'm uncomfortable with providing basic authentication out of the box without any disclaimers/warning labels/restrictions on usage. Could you please change this API to:

withBasicAuthentication :: MonadSnap m => ((ByteString, ByteString) -> m a) -> m a

and check that `rqIsSecure` is `True` within the handler. I really don't think we want to make it easy for people to send cleartext passwords out over the internet in our public API. A suitable disclaimer in the comment (that we will only authenticate secure connections using this method).

If you really feel that cleartext basic authentication is something that needs to be in the API, then add the function as `withUnsafeBasicAuthentication` with a big disclaimer in the docstring. Personally I think we're better off just omitting it.

I think the thing we all would really like here (and I think hvr mentioned it also) is RFC 2617 digest authentication. Would you be interested in tackling that?