martini-contrib/auth — pull request #8 by attilaolah (2014-04-28 10:24:58+00:00)
Title: Add auth.BasicRealm

See #6 for details.

This is a super-simple implementation, that basically just DRYs the code. I don't even think it is worth documenting, but you can persuade me, @codegangsta.

Another way of doing this would be adding two new functions `BasicRealm(username, password, realm string)` and `BasicFuncRealm(fn func(string, string) bool, realm string)`. But then it's one extra step of added complexity, and one could argue then that people might want to have the request to decide what the realm would be (e.g. by consulting the Accept-Language header). And I'm not keen on going that far.

This is simple enough yet you can change the realm if you really want.

Note that this depends on #7, which I assume is worth pulling anyway, so I didn't bother to rebase :)