summaryrefslogtreecommitdiffstats
path: root/modules/oauth/lib
diff options
context:
space:
mode:
Diffstat (limited to 'modules/oauth/lib')
-rw-r--r--modules/oauth/lib/Consumer.php7
-rw-r--r--modules/oauth/lib/OAuthStore.php10
-rw-r--r--modules/oauth/lib/Registry.php21
3 files changed, 9 insertions, 29 deletions
diff --git a/modules/oauth/lib/Consumer.php b/modules/oauth/lib/Consumer.php
index 6a16841..f17640c 100644
--- a/modules/oauth/lib/Consumer.php
+++ b/modules/oauth/lib/Consumer.php
@@ -91,9 +91,9 @@ class sspmod_oauth_Consumer {
if ($callback) {
$params['oauth_callback'] = $callback;
}
- $authorizeURL = SimpleSAML_Utilities::addURLparameter($url, $params);
+ $authorizeURL = \SimpleSAML\Utils\HTTP::addURLParameters($url, $params);
if ($redirect) {
- SimpleSAML_Utilities::redirectTrustedURL($authorizeURL);
+ \SimpleSAML\Utils\HTTP::redirectTrustedURL($authorizeURL);
exit;
}
return $authorizeURL;
@@ -130,8 +130,6 @@ class sspmod_oauth_Consumer {
$opts = array(
'ssl' => array(
'verify_peer' => FALSE,
- // 'cafile' => $file,
- // 'local_cert' => $spKeyCertFile,
'capture_peer_cert' => TRUE,
'capture_peer_chain' => TRUE,
),
@@ -158,7 +156,6 @@ class sspmod_oauth_Consumer {
$opts = stream_context_create($opts);
}
$data = file_get_contents($data_req->to_url(), FALSE, $opts);
- #print_r($data);
$dataDecoded = json_decode($data, TRUE);
return $dataDecoded;
diff --git a/modules/oauth/lib/OAuthStore.php b/modules/oauth/lib/OAuthStore.php
index cd8e0d6..974387a 100644
--- a/modules/oauth/lib/OAuthStore.php
+++ b/modules/oauth/lib/OAuthStore.php
@@ -62,8 +62,8 @@ class sspmod_oauth_OAuthStore extends OAuthDataStore {
if ($oConsumer && ($oConsumer->callback_url)) $url = $oConsumer->callback_url;
- $verifier = SimpleSAML_Utilities::generateID();
- $url = SimpleSAML_Utilities::addURLparameter($url, array("oauth_verifier"=>$verifier));
+ $verifier = SimpleSAML\Utils\Random::generateID();
+ $url = \SimpleSAML\Utils\HTTP::addURLParameters($url, array("oauth_verifier"=>$verifier));
$this->store->set('authorized', $requestTokenKey, $verifier, $data, $this->config->getValue('requestTokenDuration', 60*30) );
@@ -111,7 +111,6 @@ class sspmod_oauth_OAuthStore extends OAuthDataStore {
$callback = NULL;
if ($consumer['value']['callback_url']) $callback = $consumer['value']['callback_url'];
- // SimpleSAML_Logger::info('OAuth consumer dump(' . var_export($consumer, TRUE) . ')');
if ($consumer['value']['RSAcertificate']) {
return new OAuthConsumer($consumer['value']['key'], $consumer['value']['RSAcertificate'], $callback);
} else {
@@ -138,7 +137,7 @@ class sspmod_oauth_OAuthStore extends OAuthDataStore {
$lifetime = $this->config->getValue('requestTokenDuration', 60*30);
- $token = new OAuthToken(SimpleSAML_Utilities::generateID(), SimpleSAML_Utilities::generateID());
+ $token = new OAuthToken(SimpleSAML\Utils\Random::generateID(), SimpleSAML\Utils\Random::generateID());
$token->callback = $callback; // OAuth1.0-RevA
$this->store->set('request', $token->key, $consumer->key, $token, $lifetime);
@@ -158,8 +157,7 @@ class sspmod_oauth_OAuthStore extends OAuthDataStore {
function new_access_token($requestToken, $consumer, $verifier = null) {
SimpleSAML_Logger::info('OAuth new_access_token(' . $requestToken . ',' . $consumer . ')');
- $accestoken = new OAuthToken(SimpleSAML_Utilities::generateID(), SimpleSAML_Utilities::generateID());
- // SimpleSAML_Logger::info('OAuth new_access_token(' . $requestToken . ',' . $consumer . ',' . $accestoken . ')');
+ $accestoken = new OAuthToken(SimpleSAML\Utils\Random::generateID(), SimpleSAML\Utils\Random::generateID());
$this->store->set('access', $accestoken->key, $consumer->key, $accestoken, $this->config->getValue('accessTokenDuration', 60*60*24) );
return $accestoken;
}
diff --git a/modules/oauth/lib/Registry.php b/modules/oauth/lib/Registry.php
index 8ae9f93..b8eb7fa 100644
--- a/modules/oauth/lib/Registry.php
+++ b/modules/oauth/lib/Registry.php
@@ -107,17 +107,10 @@ class sspmod_oauth_Registry {
}
public function metaToForm($metadata) {
- // $this->flattenLanguageField($metadata, 'name');
- // $this->flattenLanguageField($metadata, 'description');
-
- return '<form action="registry.edit.php" method="post">' .
+ return '<form action="registry.edit.php" method="post">' .
'<div id="tabdiv">' .
'<ul>' .
- '<li><a href="#basic">Name and descrition</a></li>' .
- // '<li><a href="#saml">SAML 2.0</a></li>' .
- // '<li><a href="#attributes">Attributes</a></li>' .
- // '<li><a href="#orgs">Organizations</a></li>' .
- // '<li><a href="#contacts">Contacts</a></li>' .
+ '<li><a href="#basic">Name and descrition</a></li>' .
'</ul>' .
'<div id="basic"><table class="formtable">' .
$this->standardField($metadata, 'name', 'Name of client') .
@@ -127,17 +120,9 @@ class sspmod_oauth_Registry {
$this->readonlyField($metadata, 'secret', 'Consumer Secret<br/>(Used for HMAC_SHA1 signatures)') .
$this->standardField($metadata, 'RSAcertificate', 'RSA certificate (PEM)<br/>(Used for RSA_SHA1 signatures)', TRUE) .
$this->standardField($metadata, 'callback_url', 'Static/enforcing callback-url') .
-
-// $this->hiddenField('field_key', $metadata['key']) .
$this->hiddenField('field_secret', $metadata['secret']) .
- '</table></div>' .
- // '<div id="saml"><table class="formtable">' .
- // $this->standardField($metadata, 'AssertionConsumerService', 'AssertionConsumerService endpoint') .
- // $this->standardField($metadata, 'SingleLogoutService', 'SingleLogoutService endpoint') .
- // // $this->standardField($metadata, 'certFingerprint', 'Certificate Fingerprint') .
- //
- // '</table></div>' .
+ '</table></div>' .
'</div>' .
'<input type="submit" name="submit" value="Save" style="margin-top: 5px" />' .
'</form>';