Hi, Martin. Thanks again for trying to help me out.
Martin Svensson [mailto:msv...@gmail.com] said on Wednesday, July 27, 2011 8:58
AM
> Difficult to say if one cannot see the rest of the code. A couple of things
> that might cause the problem
Here is the part of the code where I'm configuring the OAuth authorizer. It's
practically identical to the sample app you sent me last week:
public Router configureRoutes(Context context, String webRootPath) throws
UnsupportedEncodingException
{
mainRouter = new Router(context);
Router authenticatedRouter = configureProtectedRoutes();
//To create an OAuth "protected" path, first create an Authorizor
object, then insert it in the routing chain
// in front of the resource that needs to be protected. The URI points
to the OAuth token validation server.
OAuthAuthorizer oauthAuthorizer = new
OAuthAuthorizer("http://ad-jwismar.alldata.com:9090/oauth/validate";);
//set the roles (OAuth calls them scopes), which identify the types of
information that will be exposed:
ArrayList roles = new ArrayList ();
roles.add(new Role("alldata", null));
oauthAuthorizer.setAuthorizedRoles(roles);
oauthAuthorizer.setNext(authenticatedRouter);
mainRouter.attach("/oauth", oauthAuthorizer);
...
> 1. I would first try this without creating a child context
If I don't create the child context, I get a nearly infinite number of warnings
telling me to create a child context :-) (I think "nearly infinite" works
out to one for each route I attach.) And then it didn't make any difference.
> 2. Depending how you configured your OAuthServer it might need more client
> protocols (but
> you should see that as an error). I would add RIAP and CLAP to be on the safe
> side
I added those, but it didn't change anything.
> 3. Turn on more logging Engine.setLogLevel(Level.FINE), this will give you
> detailed logging from the OAuth extension
Here are the logging messages with fine() logging turned on. Everything looks
like it's working correctly right up to the point where the ClientResource
tries to POST.
Processing request to:
"http://ad-jwismar.alldata.com:8082/v2/oauth/years/?oauth_token=343f5ced986675aee2c6cea78c5d41354ad4fde7bb7460f793df654f212e777545da9b0ec2b8841f";
Default virtual host selected
Base URI: "http://ad-jwismar.alldata.com:8082";. Remaining part:
"/v2/oauth/years/?oauth_token=343f5ced986675aee2c6cea78c5d41354ad4fde7bb7460f793df654f212e777545da9b0ec2b8841f"
Selected route: "/v2" ->
com.autozone.adwebservices.adrestserver.AdRestApplication@6c585a
New base URI: "http://ad-jwismar.alldata.com:8082/v2";. New remaining part:
"/oauth/years/"
Selected route: "" -> org.restlet.routing.Router@101b54e
Selected route: "/oauth" -> org.restlet.ext.oauth.OAuthAuthorizer@9aa764
New base URI: "http://ad-jwismar.alldata.com:8082/v2/oauth";. New remaining
part: "/years/"
Checking for param access_token
Didn't contain a Authorization header - checking query
Found Access Token
343f5ced986675aee2c6cea78c5d41354ad4fde7bb7460f793df654f212e777545da9b0ec2b8841f
Found scopes: ["alldata"]
Posting to validator... json =
{"scope":["alldata"],"uri":"//ad-jwismar.alldata.com:8082/v2/oauth/years/","access_token":"343f5ced986675aee2c6cea78c5d41354ad4fde7bb7460f793df654f212e777545da9b0ec2b8841f"}
By default, the outbound root of an application can't handle calls without
being attached to a parent component.
Exception or error caught in status service
Internal Server Error (500) - The server isn't properly configured to handle
client calls.
at org.restlet.resource.ClientResource.doError(ClientResource.java:484)
at org.restlet.resource.ClientResource.handle(ClientResource.java:917)
at org.restlet.resource.ClientResource.handle(ClientResource.java:888)
at org.restlet.resource.ClientResource.post(ClientResource.java:1271)
at
org.restlet.ext.oauth.OAuthAuthorizer.authorize(OAuthAuthorizer.java:222)
at org.restlet.security.Authorizer.beforeHandle(Authorizer.java:134)
at org.restlet.routing.Filter.handle(Filter.java:201)
...
--
John Wismar
Alldata Technology
916-478-3296
--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2804703