views:

162

answers:

1

I have two small http servers. One using the sun (com.sun.net.httpserver) server and one using an embedded jetty. Now I'm trying to get HTTP digest working on at least the jetty server (well, that was one of the reasons to use jetty instead of sun httpserver). Regardless of which server I utilize the basic setup is done via spring IOC container.

I don't like to use servlets for this purpose (well, using jetty I get HTTPServletRequest and HTTPServletResponse objects) and I'm new to spring security (I'm just using spring security because it seemed to be to most flexible approach regarding HTTP digest authentication). All I found about spring security was rather terse documented or completely servlet/filter oriented.

I like to know which is would be the easiest way to enable http digest for my servers. And if spring security is the answer how to wire the spring classes into my IOC container. I can imagine that dealing with http digest needs some manual actions. That is fine for me as long as I have some starting hints.

A: 

Take a look at the Spring Security Documentation. You will have to configure DigestFilter and DigestFilterEntryPoint. Also, you will have to provide UserDetailsService. A good UserDetailsService implementation to start with would be In-Memory implementation.

Rest of the configuration should be pretty standard. You can find some "Getting Started" here.

Georgy Bolyuba
This filter things are only for configuration via web.xml, right? I don't have a web.xml because I just want a "normal" web app. Or do I understand something wrong?
Norbert Hartl
Hmm. I am afraid you will have to define "normal" web app. There is no webapp without web.xml
Georgy Bolyuba
That would be one alternative to take. But it is not my choice. The security handling has IMHO nothing to do with webapps. And I don't want to use them because I can't see a benefit in pushing my code into a shell that I don't need with dependencies on an XML descriptor and a way to deploy.The other viable option is to get the functionality working on the layer below (where it belongs). That was the intention of my question.
Norbert Hartl