You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/01/26 15:20:26 UTC

[airavata-php-gateway] 01/02: Only use cafile_path if specified in config

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch ultrascan
in repository https://gitbox.apache.org/repos/asf/airavata-php-gateway.git

commit c3245971f23767c6b83f5a1919681ce5639253bd
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Fri Mar 27 15:58:35 2020 -0400

    Only use cafile_path if specified in config
---
 app/libraries/Keycloak/API/RoleMapper.php          |  6 +++---
 app/libraries/Keycloak/API/Roles.php               |  2 +-
 app/libraries/Keycloak/API/Users.php               |  6 +++---
 app/libraries/Keycloak/Keycloak.php                | 10 +++++-----
 app/libraries/Keycloak/KeycloakServiceProvider.php |  2 +-
 app/libraries/Keycloak/KeycloakUtil.php            |  2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/app/libraries/Keycloak/API/RoleMapper.php b/app/libraries/Keycloak/API/RoleMapper.php
index d60c5fe..9a44f50 100644
--- a/app/libraries/Keycloak/API/RoleMapper.php
+++ b/app/libraries/Keycloak/API/RoleMapper.php
@@ -30,7 +30,7 @@ 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){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -61,7 +61,7 @@ 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){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
 
@@ -97,7 +97,7 @@ 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){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
 
diff --git a/app/libraries/Keycloak/API/Roles.php b/app/libraries/Keycloak/API/Roles.php
index bcfc4ba..1972e74 100644
--- a/app/libraries/Keycloak/API/Roles.php
+++ b/app/libraries/Keycloak/API/Roles.php
@@ -22,7 +22,7 @@ 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){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
diff --git a/app/libraries/Keycloak/API/Users.php b/app/libraries/Keycloak/API/Users.php
index efb1b49..efbdf57 100644
--- a/app/libraries/Keycloak/API/Users.php
+++ b/app/libraries/Keycloak/API/Users.php
@@ -29,7 +29,7 @@ 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){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -75,7 +75,7 @@ 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){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -106,7 +106,7 @@ 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){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
diff --git a/app/libraries/Keycloak/Keycloak.php b/app/libraries/Keycloak/Keycloak.php
index 46b5c94..8f85975 100644
--- a/app/libraries/Keycloak/Keycloak.php
+++ b/app/libraries/Keycloak/Keycloak.php
@@ -75,7 +75,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        if($this->verify_peer){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
 
@@ -129,7 +129,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        if($this->verify_peer){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
 
@@ -167,7 +167,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        if($this->verify_peer){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
         curl_setopt($r, CURLOPT_HTTPHEADER, array(
@@ -213,7 +213,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        if($this->verify_peer){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
 
@@ -444,7 +444,7 @@ class Keycloak {
         // Decode compressed responses.
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
-        if($this->verify_peer){
+        if($this->verify_peer && $this->cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $this->cafile_path);
         }
 
diff --git a/app/libraries/Keycloak/KeycloakServiceProvider.php b/app/libraries/Keycloak/KeycloakServiceProvider.php
index 14971fd..84c8eb7 100644
--- a/app/libraries/Keycloak/KeycloakServiceProvider.php
+++ b/app/libraries/Keycloak/KeycloakServiceProvider.php
@@ -41,7 +41,7 @@ class KeycloakServiceProvider extends ServiceProvider {
                 $identityServerConfig['oauth-client-key'],
                 $identityServerConfig['oauth-client-secret'],
                 $identityServerConfig['oauth-callback-url'],
-                $identityServerConfig['cafile-path'],
+                isset($identityServerConfig['cafile-path'] ? $identityServerConfig['cafile-path'] : null,
                 $identityServerConfig['verify-peer'],
                 $identityServerConfig['service-url'],
                 $identityServerConfig['admin-username'],
diff --git a/app/libraries/Keycloak/KeycloakUtil.php b/app/libraries/Keycloak/KeycloakUtil.php
index a169274..41880cb 100644
--- a/app/libraries/Keycloak/KeycloakUtil.php
+++ b/app/libraries/Keycloak/KeycloakUtil.php
@@ -16,7 +16,7 @@ class KeycloakUtil {
         curl_setopt($r, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($r, CURLOPT_ENCODING, 1);
         curl_setopt($r, CURLOPT_SSL_VERIFYPEER, $verify_peer);
-        if($verify_peer){
+        if($verify_peer && $cafile_path){
             curl_setopt($r, CURLOPT_CAINFO, $cafile_path);
         }