Make OMB work if the configured domain name does not exclusively contain lower case letters.
If the configured domain is mixed-case OAuth throws invalidsignature errors. The current URL is part of the signated parts; since the consumer does not pass the current URL, the service has to get it itself and add it to the other OAuth params for signature rebuilding. OAuth.php uses $_SERVER for this, however, the domain is lcased in $_SERVER. Hence we pass the complete current URL as generated by common_local_url to OAuthRequest.
This commit is contained in:
commit
fc6cedd222
@ -59,7 +59,7 @@ class AccesstokenAction extends Action
|
|||||||
try {
|
try {
|
||||||
common_debug('getting request from env variables', __FILE__);
|
common_debug('getting request from env variables', __FILE__);
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_locale_url('accesstoken'));
|
||||||
common_debug('getting a server', __FILE__);
|
common_debug('getting a server', __FILE__);
|
||||||
$server = omb_oauth_server();
|
$server = omb_oauth_server();
|
||||||
common_debug('fetching the access token', __FILE__);
|
common_debug('fetching the access token', __FILE__);
|
||||||
|
@ -44,7 +44,7 @@ class FinishremotesubscribeAction extends Action
|
|||||||
common_debug('stored request: '.print_r($omb,true), __FILE__);
|
common_debug('stored request: '.print_r($omb,true), __FILE__);
|
||||||
|
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_local_url('finishuserauthorization'));
|
||||||
|
|
||||||
$token = $req->get_parameter('oauth_token');
|
$token = $req->get_parameter('oauth_token');
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class PostnoticeAction extends Action
|
|||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
try {
|
try {
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_local_url('postnotice'));
|
||||||
# Note: server-to-server function!
|
# Note: server-to-server function!
|
||||||
$server = omb_oauth_server();
|
$server = omb_oauth_server();
|
||||||
list($consumer, $token) = $server->verify_request($req);
|
list($consumer, $token) = $server->verify_request($req);
|
||||||
|
@ -69,7 +69,7 @@ class RequesttokenAction extends Action
|
|||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
try {
|
try {
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_local_url('requesttoken'));
|
||||||
$server = omb_oauth_server();
|
$server = omb_oauth_server();
|
||||||
$token = $server->fetch_request_token($req);
|
$token = $server->fetch_request_token($req);
|
||||||
print $token;
|
print $token;
|
||||||
|
@ -29,7 +29,7 @@ class UpdateprofileAction extends Action
|
|||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
try {
|
try {
|
||||||
common_remove_magic_from_request();
|
common_remove_magic_from_request();
|
||||||
$req = OAuthRequest::from_request();
|
$req = OAuthRequest::from_request('POST', common_local_url('updateprofile'));
|
||||||
# Note: server-to-server function!
|
# Note: server-to-server function!
|
||||||
$server = omb_oauth_server();
|
$server = omb_oauth_server();
|
||||||
list($consumer, $token) = $server->verify_request($req);
|
list($consumer, $token) = $server->verify_request($req);
|
||||||
|
Loading…
Reference in New Issue
Block a user