Updates for OAuth2 support

This commit is contained in:
Erik Amaru Ortiz
2013-10-22 11:17:48 -04:00
parent 54696c03ae
commit 3bbb57709c
7 changed files with 80 additions and 102 deletions

View File

@@ -1293,13 +1293,26 @@ class adminProxy extends HttpProxyController
$pmRestClient->delete();
}
$http = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
$endpoint = sprintf(
'%s://%s/sys%s/%s/%s/oauth2/grant',
$http,
$host,
SYS_SYS,
$lang,
SYS_SKIN
);
$oauthClients = new OauthClients();
$oauthClients->setClientId('x-pm-local-client');
$oauthClients->setClientSecret('179ad45c6ce2cb97cf1029e212046e81');
$oauthClients->setClientName('PM Web Designer');
$oauthClients->setClientDescription('ProcessMaker Web Designer App');
$oauthClients->setClientWebsite('www.processmaker.com');
$oauthClients->setRedirectUri('http://pmos/sysworkflow/en/neoclassic/services/oauth2_grant');
$oauthClients->setRedirectUri($endpoint);
$oauthClients->save();
$result['success'] = true;