Hi Paul,

As Sebastian responded, part of the solution is to match up the ChallengeScheme 
name with what Restlet expects. The other part is to register your helper as 
being both for client-side and server-side. I'm not sure why this is, but 
Restlet[1] always looks for a client-side helper during parseResponse.

Rhett

[1]: At least in 2.0; I haven't looked at 2.1.

On Jun 2, 2011, at 5:59 PM, Paul Morris wrote:

> Having problems implementing a custom challenge scheme with an 
> AuthenticatorHelper. I've read the documentation but I am still receiving 
> this WARNING in the logs:
> 
> WARNING: Couldn't find any helper support the HTTP_MYSCHEME challenge scheme.
> 
> This is what I'm doing code-wise...
> 
> public class MyAuthenticatorHelper extends 
> org.restlet.engine.security.AuthenticatorHelper 
> {
> 
>       public static final ChallengeScheme MYSCHEME = 
>       new ChallengeScheme(
>                       "MYSCHEME", 
>                       "MYSCHEME", 
>                       "A custom challenge authentication scheme.");
>       
>       public MyAuthenticatorHelper() 
>       {
>               super(MYSCHEME, false, true);
>       }
>       
>       @Override
>       public void formatRawRequest(ChallengeWriter cw, 
>                                                                
> ChallengeRequest cr, 
>                                                                Response 
> response, 
>                                                                
> Series<Parameter> httpHeaders) throws IOException
>                                                               
>       {
>               if (cr.getRealm() != null)
>                       cw.appendQuotedChallengeParameter("realm", 
> cr.getRealm());
>       }
>       
>       @Override
>       public void parseResponse(ChallengeResponse cr, 
>                                                         Request request, 
>                                                         Series<Parameter> 
> httpHeaders)
>       {
>               
> cr.setRawValue(request.getChallengeResponse().getRawValue().replaceFirst("token=",
>  ""));
>       }
> }
> 
> Then to the Component I am adding this line:
> 
> Engine.getInstance().getRegisteredAuthenticators().add(new 
> MyAuthenticatorHelper());
> 
> Why isn't it seeing ny helper?
> 
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2756279

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2756760

Reply via email to