Enable Grizzly to perform JaaS simple HTTP AUTH
How can I make Grizzly HTTP server allow JaaS f开发者_StackOverflow中文版or simple HTTP AUTH? I can't see any code/sample out there: There's another post here in StackOverflow that directly assumes that jaaS is available in Grizzly, but doesn't explain how to add it.
I don't think the Grizzly HTTP server provides basic auth 'out of the box'. If you do not want to use a full-blown implementation like glassfish, you can implement your own filter and add it to the list of grizzly filters. Here is an example of how to extract the login data via HTTP basic auth and how to integrate it in JAAS objects within the grizzly context. But it requires a significant amount of coding.
http://java.net/projects/jersey/sources/svn/content/trunk/jersey/samples/https-clientserver-grizzly/src/main/java/com/sun/jersey/samples/https_grizzly/auth/SecurityFilter.java?rev=5160
Hope that helps.
精彩评论