Hi. I was trying to do the same thing and I just found your unanswered
message. I know it's a old request but, for future googlers, here what I've
done.
I've override setInboundRoot(final Restlet inboundRoot) in my class that
extends Application.
@Override
public synchronized void setInboundRoot(final Restlet inboundRoot) {
MapVerifier verifier = new MapVerifier();
verifier.getLocalSecrets().put("scott", "tiger".toCharArray());
ChallengeAuthenticator authenticator = new
ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC,
"Basic Test Realm");
authenticator.setVerifier(verifier);
authenticator.setNext(inboundRoot);
super.setInboundRoot(authenticator);
}
Application is the only class I actually extend, it's the most reasonable
place where to put some custom code.
More than this, the ChallengeAuthenticator constructors require context and
I was not sure what is the right parameter.
Now that the solution work, debugging I see that getContext() actually
returns null so maybe is possible to actually declare the
ChallengeAuthenticator as a spring bean, configure verifier and next
properties and then use that as the inbound router.
Maybe I'll try when I'll have a more complete solution.
--
View this message in context:
http://restlet-discuss.1400322.n2.nabble.com/How-to-signup-a-ChallengeAuthenticator-when-using-SpringBeanRouter-tp5588475p6309297.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2724897