Forgot to point out that requestParams object can be casted to
List<Object>. Here's the code from JAXRSInvoker

List<Object> params = null;

if (request instanceof List) {

params = CastUtils.cast((List<?>)request);

} else if (request != null) {

params = new MessageContentsList(request);

}

but in reality one just needs to cast to List...


I'll get it all documented...


----- Original Message ----- From: "Sergey Beryozkin" <[email protected]>
To: <[email protected]>
Sent: Thursday, April 30, 2009 3:09 PM
Subject: Re: Jax-RS & Authorization Models


Hi

I just did a minor update to the source for custom invokers injected from Spring supported, so if you need to an access to the actual parameters then you can register a custom invoker and preprocess the request there.

Here's a sample invoker :

http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxrs/CustomJAXRSInvoker.java

it checks a user name, method name and the actual class be invoked and responds 
with 403 if some condiiton is met.
Method parameters are availbale there too. It then delegates to JAXRS invoker.

it's registered as an invoker property :
http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/resources/jaxrs_security/WEB-INF/beans.xml

One only needs to do it if actual parameter values are needed, otherwise one should be able to autorize in a RequestFilter earlier on...

cheers, Sergey

Hi

Sergey Beryozkin wrote:
classResourceInfo.getResourceProvider().getInstance();

and then getClass() on that instance, if needed

You can get the name of the operation like this :
....
Method m = ori.getMethodToInvoke();

Hi,
This works fine.  However, it doesn't give me the parameters that would be
passed to the function.  Is there any means of retrieving this info?

I see, you also need the actual parameter instances....

I was about to say you can do it like this :
List<Object> params = message.getContent(List.class);

But unfortunately, at the moment the parameter values are obtained after the request filters have been invoked...so one can only get the values in the outbound response filter which is too late in your case...I'll try to get it fixed as I think one should be able to do it without AOP if needed. Perhaps what you actually may need to do is to provide the custom JAXRSInvoker implementation by simply extending the one we ship and registering it in jaxrs:server, but I'm not sure we actually honour this configuration option at the moment. So I'll see what can be done - please try AOP in meantime :-)

cheers, Sergey


Otherwise, it looks like the AOP or some other means will have to do.
Probably the ideal method would be annotation based.

Thanks,
-Greg



Reply via email to