Re: Excluding a resource from Guard

2010-01-27 Thread mkhatib
Answering my question,
I've done this, though I still think there's a better way to do it:
Im my custom Guard class, I've override authenticate to the following.

@Override
public int authenticate(Request request) {
String path = request.getResourceRef().getPath();
if (path.endsWith(/)) path = path.substring(0, 
path.length()-1);
path = path.substring(path.lastIndexOf('/'));
if (path.equals(IYWaveConstants.REGISTRATION_URL)) return 1;

return super.authenticate(request);
}

-- 
View this message in context: 
http://n2.nabble.com/Excluding-a-resource-from-Guard-tp4433527p4467649.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Excluding a resource from Guard

2010-01-21 Thread mkhatib
I am defining my guard as a bean and it's guarding the router, I want to
exclude one/some Resource that shouldn't be guarded (e.g. a Resource to
Register the user).

bean name=root class=org.restlet.ext.spring.SpringRouter
...

bean name=guard class=ps.exalt.iywave.server.api.security.IYWaveGuard
scope=singleton   
property name=next ref=root/ 
...


Thanks
-- 
View this message in context: 
http://n2.nabble.com/Excluding-a-resource-from-Guard-tp4433527p4433527.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Basic HTTP Auth without Guards?

2010-01-18 Thread mkhatib
I am trying to implement web services that will be used on an iPhone client.
I need the user to authenticate and then make sure he is authorized before
executing an action. I am using Spring 2.5.6 along with Restlet 1.1.7. 

bean name=restletRouter class=org.restlet.ext.spring.SpringRouter

bean id=app class=org.restlet.Application

bean id=restletServer class=org.restlet.ext.spring.SpringServer

bean id=restletComponent class=org.restlet.ext.spring.SpringComponent

bean name=secretResolver
class=ps.exalt.iywave.server.api.security.CustomAuth scope=singleton/

bean name=guard class=ps.exalt.iywave.server.api.security.CustomGaurd
scope=singleton   
property name=next ref=restletRouter/ 
property name=secretResolver ref=secretResolver/
/bean


The problem is it is not asking for authentication, is there anything I am
missing?
-- 
View this message in context: 
http://n2.nabble.com/Basic-HTTP-Auth-without-Guards-tp4413298p4413298.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Basic HTTP Auth without Guards?

2010-01-18 Thread mkhatib
Hey,
Thanks Sutphin! Now it works when I run it as a standalone application, 
SpringComponent component = (SpringComponent)
context.getBean(restletComponent);
component.start()

However when I run it on Tomcat, it still doesn't do much, Is there specific
configurations to use this Guard with Tomcat?

I've in My Web.xml:

servlet
servlet-namerest/servlet-name
servlet-class
  com.noelios.restlet.ext.spring.RestletFrameworkServlet
/servlet-class
  /servlet

  servlet-mapping
servlet-namerest/servlet-name
url-pattern/*/url-pattern
  /servlet-mapping

  listener
   
listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
  /listener

And my rest-servlet.xml is like what I post earlier,
My guess is that tomcat ignores the application and guard beans in the
rest-servlet.xml and uses the router directly. Can I attach the router
directly in the xml file?

Thanks again




Rhett Sutphin wrote:
 
 Hi,
 
 On Jan 18, 2010, at 6:09 AM, mkhatib wrote:
 
 I am trying to implement web services that will be used on an iPhone
 client.
 I need the user to authenticate and then make sure he is authorized
 before
 executing an action. I am using Spring 2.5.6 along with Restlet 1.1.7. 
 
 bean name=restletRouter class=org.restlet.ext.spring.SpringRouter
 
 bean id=app class=org.restlet.Application
 
 What is the root property for the app bean?  It should be the guard.
 
 Rhett
 
 
 bean id=restletServer class=org.restlet.ext.spring.SpringServer
 
 bean id=restletComponent
 class=org.restlet.ext.spring.SpringComponent
 
 bean name=secretResolver
 class=ps.exalt.iywave.server.api.security.CustomAuth
 scope=singleton/
 
 bean name=guard
 class=ps.exalt.iywave.server.api.security.CustomGaurd
 scope=singleton   
property name=next ref=restletRouter/ 
property name=secretResolver ref=secretResolver/
 /bean
 
 
 The problem is it is not asking for authentication, is there anything I
 am
 missing?
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2439985
 
 

-- 
View this message in context: 
http://n2.nabble.com/Basic-HTTP-Auth-without-Guards-tp4413298p4413669.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Basic HTTP Auth without Guards?

2010-01-18 Thread mkhatib
Sorry I meant to say Can I attach the Guard to the Router Directly in the xml
file?


mkhatib wrote:
 
 Hey,
 Thanks Sutphin! Now it works when I run it as a standalone application, 
 SpringComponent component = (SpringComponent)
 context.getBean(restletComponent);
 component.start()
 
 However when I run it on Tomcat, it still doesn't do much, Is there
 specific configurations to use this Guard with Tomcat?
 
 I've in My Web.xml:
 
 servlet
 servlet-namerest/servlet-name
 servlet-class
   com.noelios.restlet.ext.spring.RestletFrameworkServlet
 /servlet-class
   /servlet
 
   servlet-mapping
 servlet-namerest/servlet-name
 url-pattern/*/url-pattern
   /servlet-mapping
 
   listener

 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
   /listener
 
 And my rest-servlet.xml is like what I post earlier,
 My guess is that tomcat ignores the application and guard beans in the
 rest-servlet.xml and uses the router directly. Can I attach the router
 directly in the xml file?
 
 Thanks again
 
 
 
 
 Rhett Sutphin wrote:
 
 Hi,
 
 On Jan 18, 2010, at 6:09 AM, mkhatib wrote:
 
 I am trying to implement web services that will be used on an iPhone
 client.
 I need the user to authenticate and then make sure he is authorized
 before
 executing an action. I am using Spring 2.5.6 along with Restlet 1.1.7. 
 
 bean name=restletRouter class=org.restlet.ext.spring.SpringRouter
 
 bean id=app class=org.restlet.Application
 
 What is the root property for the app bean?  It should be the guard.
 
 Rhett
 
 
 bean id=restletServer class=org.restlet.ext.spring.SpringServer
 
 bean id=restletComponent
 class=org.restlet.ext.spring.SpringComponent
 
 bean name=secretResolver
 class=ps.exalt.iywave.server.api.security.CustomAuth
 scope=singleton/
 
 bean name=guard
 class=ps.exalt.iywave.server.api.security.CustomGaurd
 scope=singleton   
property name=next ref=restletRouter/ 
property name=secretResolver ref=secretResolver/
 /bean
 
 
 The problem is it is not asking for authentication, is there anything I
 am
 missing?
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2439985
 
 
 
 

-- 
View this message in context: 
http://n2.nabble.com/Basic-HTTP-Auth-without-Guards-tp4413298p4413710.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Basic HTTP Auth without Guards?

2010-01-18 Thread mkhatib
It works now :-)
I've edited my web.xml file to use this:

servlet
servlet-namerest/servlet-name
servlet-class
  com.noelios.restlet.ext.spring.RestletFrameworkServlet
/servlet-class
init-param 
param-nametargetRestletBeanName/param-name   
param-valueguard/param-value   
/init-param 
load-on-startup1/load-on-startup 
  /servlet

Instead of this:
servlet
servlet-namerest/servlet-name
servlet-class
  com.noelios.restlet.ext.spring.RestletFrameworkServlet
/servlet-class
/servlet

Thanks again :-)


mkhatib wrote:
 
 Sorry I meant to say Can I attach the Guard to the Router Directly in the
 xml file?
 
 
 mkhatib wrote:
 
 Hey,
 Thanks Sutphin! Now it works when I run it as a standalone application, 
 SpringComponent component = (SpringComponent)
 context.getBean(restletComponent);
 component.start()
 
 However when I run it on Tomcat, it still doesn't do much, Is there
 specific configurations to use this Guard with Tomcat?
 
 I've in My Web.xml:
 
 servlet
 servlet-namerest/servlet-name
 servlet-class
   com.noelios.restlet.ext.spring.RestletFrameworkServlet
 /servlet-class
   /servlet
 
   servlet-mapping
 servlet-namerest/servlet-name
 url-pattern/*/url-pattern
   /servlet-mapping
 
   listener

 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
   /listener
 
 And my rest-servlet.xml is like what I post earlier,
 My guess is that tomcat ignores the application and guard beans in the
 rest-servlet.xml and uses the router directly. Can I attach the router
 directly in the xml file?
 
 Thanks again
 
 
 
 
 Rhett Sutphin wrote:
 
 Hi,
 
 On Jan 18, 2010, at 6:09 AM, mkhatib wrote:
 
 I am trying to implement web services that will be used on an iPhone
 client.
 I need the user to authenticate and then make sure he is authorized
 before
 executing an action. I am using Spring 2.5.6 along with Restlet 1.1.7. 
 
 bean name=restletRouter class=org.restlet.ext.spring.SpringRouter
 
 bean id=app class=org.restlet.Application
 
 What is the root property for the app bean?  It should be the guard.
 
 Rhett
 
 
 bean id=restletServer class=org.restlet.ext.spring.SpringServer
 
 bean id=restletComponent
 class=org.restlet.ext.spring.SpringComponent
 
 bean name=secretResolver
 class=ps.exalt.iywave.server.api.security.CustomAuth
 scope=singleton/
 
 bean name=guard
 class=ps.exalt.iywave.server.api.security.CustomGaurd
 scope=singleton   
property name=next ref=restletRouter/ 
property name=secretResolver ref=secretResolver/
 /bean
 
 
 The problem is it is not asking for authentication, is there anything I
 am
 missing?
 
 --
 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2439985
 
 
 
 
 
 

-- 
View this message in context: 
http://n2.nabble.com/Basic-HTTP-Auth-without-Guards-tp4413298p4413770.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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