airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [1/2] airavata-php-gateway git commit: Set CAINFO_PATH everywhere calls are made to Keycloak
Date Fri, 29 Sep 2017 18:33:03 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 9069b814b -> 5a4a9c3dd


Set CAINFO_PATH everywhere calls are made to Keycloak


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/9041b4cc
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/9041b4cc
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/9041b4cc

Branch: refs/heads/develop
Commit: 9041b4cc09541f14f012be81eaf1ca7f5c1e44b8
Parents: fa310a1
Author: Marcus Christie <machrist@iu.edu>
Authored: Fri Sep 29 14:32:22 2017 -0400
Committer: Marcus Christie <machrist@iu.edu>
Committed: Fri Sep 29 14:32:22 2017 -0400

----------------------------------------------------------------------
 app/libraries/Keycloak/API/RoleMapper.php |  9 +++++++++
 app/libraries/Keycloak/API/Roles.php      |  3 +++
 app/libraries/Keycloak/API/Users.php      |  9 +++++++++
 app/libraries/Keycloak/Keycloak.php       | 20 +++++++++++++++-----
 app/libraries/Keycloak/KeycloakUtil.php   |  4 +++-
 5 files changed, 39 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9041b4cc/app/libraries/Keycloak/API/RoleMapper.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/RoleMapper.php b/app/libraries/Keycloak/API/RoleMapper.php
index f2fab42..d60c5fe 100644
--- a/app/libraries/Keycloak/API/RoleMapper.php
+++ b/app/libraries/Keycloak/API/RoleMapper.php
@@ -30,6 +30,9 @@ class RoleMapper extends BaseKeycloakAPIEndpoint {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
             "Authorization: Bearer " . $access_token
         ));
@@ -58,6 +61,9 @@ class RoleMapper extends BaseKeycloakAPIEndpoint {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
 
         curl_setopt($r, CURLOPT_POST, true);
         $data = json_encode($role_representations);
@@ -91,6 +97,9 @@ class RoleMapper extends BaseKeycloakAPIEndpoint {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
 
         curl_setopt($r, CURLOPT_CUSTOMREQUEST, "DELETE");
         curl_setopt($r, CURLOPT_POST, true);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9041b4cc/app/libraries/Keycloak/API/Roles.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/Roles.php b/app/libraries/Keycloak/API/Roles.php
index 565b860..bcfc4ba 100644
--- a/app/libraries/Keycloak/API/Roles.php
+++ b/app/libraries/Keycloak/API/Roles.php
@@ -22,6 +22,9 @@ class Roles extends BaseKeycloakAPIEndpoint {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
             "Authorization: Bearer " . $access_token
         ));

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9041b4cc/app/libraries/Keycloak/API/Users.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/API/Users.php b/app/libraries/Keycloak/API/Users.php
index e0e112c..efb1b49 100644
--- a/app/libraries/Keycloak/API/Users.php
+++ b/app/libraries/Keycloak/API/Users.php
@@ -29,6 +29,9 @@ class Users extends BaseKeycloakAPIEndpoint {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
             "Authorization: Bearer " . $access_token
         ));
@@ -72,6 +75,9 @@ class Users extends BaseKeycloakAPIEndpoint {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
             "Authorization: Bearer " . $access_token
         ));
@@ -100,6 +106,9 @@ class Users extends BaseKeycloakAPIEndpoint {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
             "Authorization: Bearer " . $access_token
         ));

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9041b4cc/app/libraries/Keycloak/Keycloak.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 25a059e..fc839c3 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -75,7 +75,9 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
 
         // Add client ID and client secret to the headers.
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -127,7 +129,9 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
 
         // Add client ID and client secret to the headers.
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -163,7 +167,9 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
             "Authorization: Bearer " . $token
         ));
@@ -207,7 +213,9 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
 
         // Add client ID and client secret to the headers.
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -434,7 +442,9 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        if($this->verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
+        }
 
         $result = curl_exec($r);
         if ($result == false) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9041b4cc/app/libraries/Keycloak/KeycloakUtil.php
----------------------------------------------------------------------
diff --git a/app/libraries/Keycloak/KeycloakUtil.php b/app/libraries/Keycloak/KeycloakUtil.php
index 6628052..a169274 100644
--- a/app/libraries/Keycloak/KeycloakUtil.php
+++ b/app/libraries/Keycloak/KeycloakUtil.php
@@ -16,7 +16,9 @@ class KeycloakUtil {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $verify_peer);
-        curl_setopt($r, CURLOPT_CAINFO, $cafile_path);
+        if($verify_peer){
+            curl_setopt($r, CURLOPT_CAINFO, $cafile_path);
+        }
 
         // Assemble POST parameters for the request.
         $post_fields = "client_id=admin-cli&username=" . urlencode($admin_username) .
"&password=" . urlencode($admin_password) . "&grant_type=password";


Mime
View raw message