Hi Tobias,

Are you touching/consuming the entity in any way inside your custom 
ChallengeAuthenticator?

As the entity is socket-bound (transient), it can only be read once unless 
cached.

Best regards,
Jerome
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.o​rg
Noelios Technologies ~ http://www.noelios.com




-----Message d'origine-----
De : Tobias Girschick [mailto:[email protected]] 
Envoyé : mardi 28 décembre 2010 14:00
À : [email protected]
Objet : No represnetation entity behind guard

Hi,

I am trying to protect part of my resources with a custom 
ChallengeAuthenticator. The authentication and authorization works fine. The 
only thing that's strange is, that as soon as I put a resource behind the guard 
the methods that handle POST requests don't work anymore. Up to now code like 
that worked (without guard):

@Post("form")
public Representation acceptRepresentation(Representation entity) {
        String uri = null;
        try {
                if (entity != null) {
                        if 
(MediaType.APPLICATION_WWW_FORM.equals(entity.getMediaType(), true)) {
                                Form form = new Form(entity);                   
                                
                                uri = form.getValues("dataset_uri");
                                
[....]

Now that the resource is behind the guard the entity is NULL. The
createInboundRoot() method in my Application looks like that:

@Override
    public synchronized Restlet createInboundRoot() {            
        Router router = new Router(getContext());
       
            /*
             * Make the entry page not secure to enable easier access and 
             * show the user a form for the "login" in the browser
             * 
             * All other endpoints should be attached to the secureRouter
             * to be secured by the OpenTox OpenSSO system
             * There will be /sec in the URI
             */
            router.attach("", SecureIndexResourceTUM.class);
            router.attach("/", SecureIndexResourceTUM.class);
            
            /*
             *  secure URIs
             *  Available only for tox members
             *  Enroler = Interface... implemented by Authenticator
             */ 
            
            OpenSSOAuthorizer toxAuth = new OpenSSOAuthorizer();
            OpenSSOAuthenticator guard = new OpenSSOAuthenticator(getContext(),
false, "text");

            Router secureRouter = new Router(getContext());
            toxAuth.setNext(secureRouter);

            secureRouter.attach("", SecResource.class);
            secureRouter.attach("/", SecResource.class);
            secureRouter.attach("/userinfo", UserInfoResource.class);

            
            router.attach("/sec", toxAuth);
            guard.setNext(secureRouter);
        
            return router;
}

Any ideas anybody? Is there another possibility to get the form parameters? 
--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/No-represnetation-entity-behind-guard-tp5871763p5871763.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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

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

Reply via email to