I think you'll need to give a more detailed explanation of what you're doing and what happens.
What version are you running, what security setup do you have, how have you configured your web application and what messages are output on the server.
It sounds like you're getting the security to activate OK but your authentication is failing. So what's happening on the server?
More details are always useful if you want to get useful feedback on a problem.
I'm having the same problem, went through all the possible combinations that would produce different results, but still could not get it to work.
I've researched the forums and the spec, I'm at a point where simple step by step guidance would help a lot.
Or if it's too much to ask for, can some one post a working example here that would include login-config.xml, jboss-service.xml, -service.xml, web.xml, jboss-web.xml.