if (call.has("owner"))
owner = call.getString("owner");
getLogger().info(
"In Validator resource - searching for token = " + token);
Token t = generator.findToken(token);
if (t == null) {
response.put("authenticated", authenticated);
error = OAuthError.INVALID_TOKEN.name();
// setStatus(Status.CLIENT_ERROR_FORBIDDEN);
} else {
getLogger().info("In Validator resource - got token = " + t);
if (t instanceof ExpireToken) {
// check that the right token was used
ExpireToken et = (ExpireToken) t;
if (!token.equals(et.getToken())) {
error = OAuthError.INVALID_TOKEN.name();
getLogger().warning(
"Should not use the refresh_token to sign!");
}
}
// Todo do more fine grained scope comparison.
getLogger().info("Received uri = " + uri);
getLogger().info("Received scope = " + scopes);
getLogger().info("Received owner = " + owner);
AuthenticatedUser user = t.getUser();
authenticated = (user == null) ? false : true;
if (!authenticated) {
error = OAuthError.INVALID_REQUEST.name();
}