Re: CAS authentication in Restlet server

2009-11-10 Thread Arjohn Kampman
Hi Rhett,

Many thanks for these pointers and your suggestions. The code looks nice
and clean. The license for this code looks very BSD-like, is that
correct?

I noticed that this code is based on acegi. Is this easier/better than
using the CAS client code directly?

Arjohn

Rhett Sutphin wrote:
 I have done this for my Restlet-based API.  I can point you to the  
 code[1], but since the application is a redistributable webapp which  
 supports several authentication plugins, the implementation is  
 probably more indirect than you need.  Also, please note that my  
 experience is with Restlet 1.1 only so far -- I haven't tried to  
 update this application to 2.0.
 
 If I were adding support for just CAS, I would define a new challenge  
 scheme (call it something like cas_proxy_ticket) and define a Guard  
 and AuthenticationHelper pair which handle this scheme.  This would  
 mean that a client would need to acquire a proxy ticket and then  
 include it in the HTTP request as the Authentication header, something  
 like
 
 Authentication: cas_proxy_ticket PT-123456789
 
 Rhett

-- 
Arjohn Kampman, Senior Software Engineer
Aduna - Semantic Power
www.aduna-software.com

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


DELETE goes to GET !!

2009-11-10 Thread webpost
Hi everyone,

I have writed a simple resource that extend ServerResource and override 
delete(Variant v). When I do a DELETE request on this resource nothing 
happened. So I have overrided get(Variant v) and now when I do a DELETE 
request, the get method is called.
I have added many breakpoints and I can see that the get method is called from 
the getInfo method..

But I don't want that, I want to delete a resource not to retrieve it and I 
don't really understand why the default getInfo(Variant v) method call the 
get(Variant v) method.

Can you help me ?

Thanks.


Here is my resource : 
public class TemplateResource extends ServerResource {
  @Override
  protected void init() { 
getVariants().put(Method.DELETE,  
Arrays.asList(new Variant[]{
new Variant(MediaType.TEXT_XML),
new Variant(MediaType.APPLICATION_XML)
}));
  }
  @Override
  protected Representation get(Variant variant) throws ResourceException {
System.out.println(GET +getRequestAttributes().get(identifier));
return super.get(variant);
  }
  @Override
  protected Representation delete(Variant variant) throws ResourceException {
System.out.println(DELETE +getRequestAttributes().get(identifier));
return Representation.createEmpty();
  }

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


Automatic conversion with XStream

2009-11-10 Thread legege
Hi,

Is there a good way to change the default XStream object that will be used
for automatic XML conversion? The power of Restlet 2.0 is really there, but
it's really difficult to change the XStream object used in a
XstreamRepresentation. Am I missing something?

  @Get(xml)
  public Patate retrieve() {
return new Patate();
  }

The result is something similar to this
  com.example.Patate
 test1 /
  /com.example.Patate

Which is really not what I want. This is the expected result, with a
correctly configured XStream object (with alias):
  patate
 test1 /
  /patate

Thanks for your help!

-- 
View this message in context: 
http://n2.nabble.com/Automatic-conversion-with-XStream-tp3983313p3983313.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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