private boolean checkCanAuthorize(final OAuth2Accessor accessor) {
final boolean isLogging = BasicOAuth2Request.LOG.isLoggable();
if (isLogging) {
BasicOAuth2Request.LOG.entering(BasicOAuth2Request.LOG_CLASS, "checkCanAuthorize", accessor);
}
boolean ret = true;
if (BasicOAuth2Request.LOG.isLoggable()) {
BasicOAuth2Request.LOG.log("securityToken = {0}", this.securityToken);
}
final String pageOwner = this.securityToken.getOwnerId();
final String pageViewer = this.securityToken.getViewerId();
if (BasicOAuth2Request.LOG.isLoggable()) {
BasicOAuth2Request.LOG.log("pageOwner = {0}", pageOwner);
BasicOAuth2Request.LOG.log("pageViewer = {0}", pageViewer);
}
if (pageOwner == null || pageViewer == null) {
accessor.setErrorResponse(null, OAuth2Error.AUTHORIZE_PROBLEM,
"pageOwner or pageViewer is null", "");
ret = false;
} else if (!this.fetcherConfig.isViewerAccessTokensEnabled() && !pageOwner.equals(pageViewer)) {
accessor.setErrorResponse(null, OAuth2Error.AUTHORIZE_PROBLEM, "pageViewer is not pageOwner",
"");
ret = false;
}
if (isLogging) {
BasicOAuth2Request.LOG.exiting(BasicOAuth2Request.LOG_CLASS, "checkCanAuthorize", ret);
}
return ret;
}