openmrs/openmrs-core — pull request #249 by rapilabs (2013-03-14 13:14:36+00:00)
Title: TRUNK-3924: Setup annotation based basic authentication for module developers

Attempting to setup some kind of annotation based basic auth for module developers by using Spring HandlerInterceptors. This is a follow-on [this conversation from the developer mailing list](https://groups.google.com/a/openmrs.org/d/msg/dev/PH9Z1fQrox8/zwRPsGr5o_cJ)

I've created an @Interceptors annotation based on [this guy's work](http://karthikg.wordpress.com/2009/10/12/athandlerinterceptor-for-spring-mvc)

From there I've setup a standard basic authentication interceptor which attempts to get the credentials from the 'Authorize' header and pass them to Context.authenticate(). If no credentials are supplied then a HTTP 401 response code is sent, requesting that the client authenticate.

Part of the discussion was that different module developers require different response types, which I believe they can achieve by subclassing this interceptor and providing their own response mechanism.

Note: I'm not too familiar with the package layout so I've just added them to the org.openmrs.web package for now.